Vim redir command
Updated:
Story
I was filing a bug on YouCompleteMe vim plugin and they request the output of :YcmDebugInfo.
This command dumps output onto terminal and I can use my terminal emulator features to copy (iTerm2).
But what if the dump was much longer and displayed by the more pager?
Surely there must be a way to dump this to a file?
redir
Enter :redir.
It’s how redirection to a variable, register, or file is done.
The more common user of this would be vimscripts, where you might want to dump debugging information.
redir > ycm_debug_info.txt
:YcmDebugInfo
redir END
This will redirect the vim’s stdout equivalent to a file.
From there, I could pbcopy and paste it into the github issue.
Uses
I think this knowledge is more compelling to me to dump the output of :ALEInfo.
Then I could grep, filter, and view this in less.
Sure we could make the logs nicer but there’s only so much effort that can be put into formatting :ALEInfo output
before you’re spending too much time on side of the equation.