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?


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
:redir END
:set more


:help :redir
:help 'more'

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

redir => mychanges
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.