sponsor Vim development Vim logo Vim Book Ad

intermediate Tip #295: Line/word/file/whatever completion

 tip karma   Rating 63/29, Viewed by 2324 

created:   July 30, 2002 13:08      complexity:   intermediate
author:   Nopik      as of Vim:   6.0

In addition to vimtip #291 you can use whole <C-x> completion mode. It can complete whole lines (<C-x>l, then <C-p>, <C-n>), filenames (<C-f>), keywords, words from custom dictionary and many, many others. During coding it usually saves a LOT of key strokes ;) This mode has many other powerful features, for example when completing word (by <C-x><C-p> or just by <C-p>) you can continue completion with another <C-x><C-p>. For example, after writing such text:

this is first line
second line is here

Placing cursor at third line and pressing <C-x>l will double last line - <C-n>, <C-p> in this moment can be used to manipulate completed line. Or, instead of completing whole line you can press 'f' and then complete by <C-p> which will result in 'first' word. After that you can <C-x><C-p> to get 'line' word (since this is next word after 'first'). Try yourself for other powerful combinations.

 rate this tip  Life Changing Helpful Unfulfilling 

<<Use Ctrl-S to save current or new files. | Attach the currently open file to email >>

Additional Notes

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