8

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?

9

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>
  • It's a nice little remap (and I learned something about remap in the process, which is very nice, but I am willing/intending to lost the screen real-estate... of coruse, ideally it would be in a little tear-off window... – Joe Oct 13 '13 at 17:40
  • Vim doesn't support tear-off windows, but apart from that, I've outlined how you'd implement that. – Ingo Karkat Oct 14 '13 at 7:53
3

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.

1

While also searching for an alternative to typing :reg I found this plugin:

https://github.com/junegunn/vim-peekaboo

It displays and lets you choose registers when you type " and @ in normal mode and CTRL-r in insert mode.

I found it here: https://github.com/junegunn/fzf.vim/issues/10

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.