Wednesday, 24 June 2009


Vim: Including a register's contents in a substitute

"sub "fred" with contents of register "a" (Control R)

or from the paste buffer


Here you actually do a Control-R.

It is often preferable to do use the following

:s/fred/\=@a/g : better alternative as register not displayed

unfortunately the \=@a must be at the beginning of replacement string


Labels: ,

Thanks this is an excellent tip,
it worked well when I finally realised (as you said) I actually have to do a Ctrl-R on the keyboard. I wanted both strings to come from registers so it looked like this:

(expanding the search string as it was typed.
Must try that!

Post a Comment

<< Home

This page is powered by Blogger. Isn't yours?

Subscribe to Posts [Atom]