8 years ago
Display the numbered registers, press a key and paste it to the buffer
function! Reg() reg echo "Register: " let char = nr2char(getchar()) if char != "\<Esc>" execute "normal! \"".char."p" endif redraw endfunction command! -nargs=0 Reg call Reg()
yang-ling 8 years ago
Sorry but I don't know how to use this snippet.
What does this
command! -nargs=0 Reg call Reg() | normal <cr> do?
I put the
Reg() function to my vimrc and executed the last command, but nothing happened.
I directly executed
:call Reg() and that worked.
Ferran Pelayo Monfort 8 years ago
That line makes the :Reg command available (as an alias for :call Reg()). The
normal <cr> part was used to delete the
trailing characters error message but now it's not a problem anymore.
I've updated the snippet a little bit so it solves those problems.
craigp 7 years ago
Nice one, better than using YankStack or something like that
Zach Queal 3 years ago
Hey, this is really great! Thanks!