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 communityI 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.
This peekaboo plugin is pretty good for for previewing registers. When you press "
or @
in normal mode, or ctrl-r
in insert mode, a split will open to show you the register contents.
Preview from the plugin repo:
"
and @
in normal mode breaks just about all macros that use registers. FWIW.
– Sato Katsura
Jul 6 '16 at 6:32
@
. The README notes that non-recursive maps will cause problems. I agree that it'd be nice if it could be configured to just view the registers, though.
– Tommy A
Jul 6 '16 at 16:29
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
"Xp
Where X
is the result of input()
.
I would recommend using
:reg
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
x
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.
:dis
and :reg
? I always use the former.
– Philip Kearns
Jun 28 '16 at 12:01