[CentOS] Slightly OT: Vim command (or macro) to replace space under cursor by "  " (without deleting the following word)

Niki Kovacs contact at kikinovak.net
Mon Oct 5 10:34:24 UTC 2009


I'm using Vim to edit some static XHTML pages.

I have to (manually) check for non-breakable spaces in my text, and 
eventually replace simple spaces by the following character sequence:


Usually, when I perform the same operation over and over in a text, I do 
it once, and then repeat it in command mode using [.]. But I can't 
figure out how to do this here.

Here's what the according macro would look like. Pressing F2 would 
replace the space under the cursor by " " :

:map <F2> cw&nbsp;<ESC>

... except this also deletes the word after the cursor, which is annoying.

Any suggestions ?



More information about the CentOS mailing list