Always show the register list in vim

I'm getting the hang of using registers in Vim, but it would be really handy not to have to keep typing :reg to see where everything was. is it possible to set vim up so that the register panel is always visible?


Solution 1:

The output of :reg is fleeting, you'd have to capture it (with :redir), and show it in a scratch buffer, and then find triggers to regularly update it. Possible, but difficult, and I'd permanently rob you of valuable screen real estate.

Alternative

Instead, I have a little shortcut to quickly bring up the contents of the most important ones. Because "" is the same as leaving off the register specification, this is easy to type (especially after the first ", when I start thinking: "Okay, which register do I want?", I can just type another ", and get this handy help), and it doesn't override any built-in commands.

" List contents of all registers (that typically contain pasteable text).
nnoremap <silent> "" :registers "0123456789abcdefghijklmnopqrstuvwxyz*+.<CR>

Solution 2:

It turns out that the answer is outside vim.

vim stores it's registers in the .viminfo file (normally in the root) - so we really just need to watch it for changes.

A very simple way is the 'watch command' with a bit of command line fudging:

watch "cat .viminfo | grep -A 1 '\"[0-9a-z]'"

This prints out the current state of the vim registers and can be running in an entirely different window.

The slight drawback is that vim normally only saves it's registers to viminfo on file exit, but you can force the saving with the command ':wv'. Mapping this to a spare key gives you one touch updating of the register view.