I use the registers a lot for copy/pasting, but I always forgot in which register my content is.
Is there a way to display the registers before pasting?
Ideally it would leave the register on screen when selecting the one we want.
Vi and Vim Stack Exchange is a question and answer site for people using the vi and Vim families of text editors. It only takes a minute to sign up.Sign up to join this community
This peekaboo plugin is pretty good for for previewing registers. When you press
@ in normal mode, or
ctrl-r in insert mode, a split will open to show you the register contents.
Preview from the plugin repo:
I made up this mapping to display the register list and select the one to be pasted:
nnoremap "p :reg <bar> exec 'normal! "'.input('>').'p'<CR>
This display the register list with
:reg and execute the normal command
X is the result of
I would recommend using
It will show the contents of all registers (you can scroll through using j and k).
If you just want to show the contents of one register, you can go to command mode and type
: Ctrl + r
then the register, for example the x register
which will paste the contents of the register into the command line. You can then escape out of the command line after viewing your register.