3

I know that you can print the changelist by running :changes. Is there a way to get this information in vimscript? Even by parsing the print somehow?

4

You can use the :redir command to redirect command-line output to a register, a file, or a variable. To capture the output of :changes in register a, execute the following.

:set nomore
:redir @a
:changes
:redir END
:set more

See

:help :redir
:help 'more'
2

You can capture the raw output of any Ex command with :redir:

redir => mychanges
changes
redir END

mychanges is a string that you manipulate like any other string.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.