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?

2 Answers2

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'
garyjohn
  • 36,494
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.

romainl
  • 23,415