sponsor Vim development Vim logo Vim Book Ad

basic Tip #4: Any word completion

 tip karma   Rating 552/164, Viewed by 7531 

created:   February 24, 2001 15:48      complexity:   basic
author:   [email protected]      as of Vim:   5.7

Either when programming or writing, I tend to have some identifiers or words that I use all the time. By sheer accident, I noticed the 'ctrl-n' command, that will attempt to complete the word under the cursor. Hit it once, and it will try to complete it with the first match in the current file. If there is no match, it will (at least in the case of C code) search through all files included from the current one. Repeated invocations will cycle through all found matches.

 rate this tip  Life Changing Helpful Unfulfilling 

<<use vim to quickly compile java files | Quickly searching for a word >>

Additional Notes

[email protected], February 25, 2001 12:10
See vimtip #11 for more details...
[email protected], October 12, 2002 2:17
that is definitely a life changing tip.

especially when programming and trying to recal variable names and so on. wow. i had no idea.

[email protected], February 2, 2003 1:38
Outstanding! I've been following std/boost guidelines for C++ code which specify longish_variable_names_with_lots_of_underbars, since everything is lowercase, you have fewer identifiers to choose from, so your identifiers can get quite long, (i.e. return_temporary_buffer from std). With this feature, it all makes sense. Typos are on the decline. Life altering, indeed.
[email protected], February 7, 2003 13:10
Great tip!

thanks a lot.  Yes, I agree, life changing!.

Herman.
Anonymous, June 15, 2003 15:14
Damn, this saves me about 1000 keystrokes a day.
Anonymous, July 3, 2003 17:33
I love vim ;-p
[email protected], August 11, 2003 4:34
Of course this tip is a life changing one :)

Note that you can ask vim for a previous word compeltion with <Ctrl>P

Yo ucan also, for use facilities, map this combo on a not-often-used key such as the '²' one.

But, does anyone know how to make Vim read the Pel modules inculded for compeltion on function names ? Such as it did when editing C code ?

Thanks a lot.
Anonymous, January 17, 2004 18:31
I wish I had known this earlier. Thank for the tip!
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 [email protected] after searching the archive. Help Bram help Uganda.
Sponsored by Web Concept Group Inc. SourceForge Logo