Vim Tips Wiki

Quickly change word or line

1,624pages on
this wiki
Add New Page
Talk0 Share
Tip 1009 Printable Monobook Previous Next

created 2005 · complexity basic · author Anupam · version 5.7

To quickly change a word you can use cw,caw or ciw. Use c$ or just C to quickly change from the cursor to the end of a line, cc to change an entire line, or cis for a sentence.

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 alsoEdit


Ad blocker interference detected!

Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.

Also on Fandom

Random Wiki