Stefano Zacchiroli: vim ctrl r
Vim's Feature of the Day #1: i_CTRL-R
I'm really astonished of how much there's to learn about
Vim and how much you can forget
about it, especially because I consider myself a rather power user
of my beloved editor.
Digging into my ~/.vim/after/ftplugin/tex.vim I found
some mappings that were laying there from quite a while (I think I
wrote them something like 4 years ago):
vmap ,b "zdi\textbf <C-R>z <ESC>
vmap ,e "zdi\emph <C-R>z <ESC>
vmap ,t "zdi\texttt <C-R>z <ESC>
Looking at them I went through :help i_CTRL-R ... and
it's wonderful! Hitting CTRL-R in insert mode Vim enters in a
"waiting for a register name" mode and when received it inserts its
content without leaving insert mode.
That's amazingly quick, and I'm already addicted to two
combos:
- CTRL-R " which inserts the content of the unnamed register (i.e. the last stuff you yanked/deleted/...). That's interesting since I often end up doing: go somewhere, yank, go somewhere else, enter insert mode, type stuff, exit insert mode, put, re-enter insert mode
- CTRL-R + which inserts the content of the X clipboard, finally an handy way (or better, a way I'm apparently able to remember) to copy stuff from a Gnome application and paste it back in Vim without having to use the "edit" menu
