Vim Tips Wiki
Register
(Improve, merge Changing word, rm {{review}})
Line 1: Line 1:
{{review}}
 
 
{{TipImported
 
{{TipImported
 
|id=1009
 
|id=1009
Line 10: Line 9:
 
|rating=7/4
 
|rating=7/4
 
}}
 
}}
  +
Here are mappings for "automatic" versions of the ''change word'' and ''change line'' commands.
 
  +
  +
To quickly change a word you can use <tt>cw</tt> or <tt>ciw</tt>, to quick change a line you can use <tt>c$</tt> or <tt>ci$</tt>
   
 
The standard ''change word'' command requires you to type <tt>cw</tt>, then a new word, then press Escape. Using the version below, you would type <tt>pw</tt>, then a new word, then press Space to exit back to normal mode. Or, you would type <tt>p$</tt>, then a new line, then press Enter.
 
The standard ''change word'' command requires you to type <tt>cw</tt>, then a new word, then press Escape. Using the version below, you would type <tt>pw</tt>, then a new word, then press Space to exit back to normal mode. Or, you would type <tt>p$</tt>, then a new line, then press Enter.
Line 20: Line 21:
 
</pre>
 
</pre>
   
  +
==See also==
  +
* {{help|c}}
  +
* {{help|movement}}
 
==Comments==
 
==Comments==
Thanks. I have an arm injury and this helps me save my stupid pinky.
 
I love vim. I've noticed I am constantly hitting ':', '/' and <enter> which is exascerbating my problem.
 
 
Besides, it is just a good tip. :-)
 
----
 

Revision as of 00:28, 17 April 2008

Tip 1009 Printable Monobook Previous Next

created October 5, 2005 · complexity basic · author Anupam · version 5.7



To quickly change a word you can use cw or ciw, to quick change a line you can use c$ or ci$

The standard change word command requires you to type cw, then a new word, then press Escape. Using the version below, you would type pw, then a new word, then press Space to exit back to normal mode. Or, you would type p$, then a new line, then press Enter.

nmap pw :inoremap <lt>Space> <lt>Space><lt>Esc>:iunmap <lt>lt>Space><lt>CR><CR> cw

nmap p$ :inoremap <lt>CR> <lt>CR><lt>Esc>:iunmap <lt>lt>CR><lt>CR><CR> c$

See also

Comments