sponsor Vim development Vim logo Vim Book Ad

basic Tip #871: Changing word

 tip karma   Rating -15/15, Viewed by 1437 

Read and edit this tip on the Vim tip wiki. The wiki may have a more recent version of this tip.

created:   February 9, 2005 10:07      complexity:   basic
author:   Anonymous      as of Vim:   6.0

We know that * or # is used for searching the entire word no matter where the cursor is positioned within the word.
Similar idea if applied for changing a word would be helpful:

map <C-q> bcw

This is the simplest of cases that will allow you change the entire word regardless of the position of the cursor by hitting Control + q.

 rate this tip  Life Changing Helpful Unfulfilling 

<< Resize terminal window to original size when quitting vim | Finding phone numbers >>

Additional Notes

Ivan Tishchenko, February 9, 2005 10:18
As for me, this is not a big advantage.  Pressing "bcw" is even faster than <c-q>.  (And <c-q>, which is one of a few unmapped CTRL-char combinations, may be used for something more complex :)

"viw" also may help in such a cases (i.e. cases where it's necessary to do something with word under cursor).
Anonymous, February 9, 2005 13:47
I use ciw, change inner word
Anonymous, February 9, 2005 22:46
This has little disadvantage, if cursor stand on begin of word and you press <C-q>, word before actual one is deleted. Sorry my terrible english.
If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.
Sponsored by Web Concept Group Inc. SourceForge.net Logo