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

John R Pierce pierce at hogranch.com
Mon Oct 5 17:10:52 UTC 2009


Niki Kovacs wrote:
> :map <F2> cw&nbsp;<ESC>
>
> ... except this also deletes the word after the cursor, which is annoying.
>   

    c1l&nbsp;<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&nbsp;

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.




More information about the CentOS mailing list