Hi,
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 <ESC>
... except this also deletes the word after the cursor, which is annoying.
Any suggestions ?
Cheers,
Niki
On Oct 5, 2009, at 5:34, Niki Kovacs wrote:
Here's what the according macro would look like. Pressing F2 would replace the space under the cursor by " " :
:map <F2> cw <ESC>
... except this also deletes the word after the cursor, which is annoying.
Any suggestions ?
Have you tried the "s" command (substitute) instead of "cw"?
Alfred
Niki Kovacs wrote:
:map <F2> cw <ESC>
... except this also deletes the word after the cursor, which is annoying.
c1l <esc>
thats digit 1, lower case letter L, lower L being the move left command. the 1 is uneeded, but c3l would change 3 characters, etc.
btw, my favorite way of doing what you said would be...
/ <enter> c1l
then n to find the next space, and . to execute the change op. you sure don't want to change spaces that are inside < > commands, so a global change and replace is not suitable.