Wikia

Vim Tips Wiki

Line/word/file/whatever completion

Talk0
1,610pages on
this wiki
Revision as of 18:57, March 28, 2011 by Fritzophrenic (Talk | contribs)

Tip 295 Printable Monobook Previous Next

created July 30, 2002 · complexity intermediate · author Nopik · version 6.0


In addition to VimTip291 you can use whole <C-x> completion mode. It can complete whole lines (<C-X><C-L>, then <C-P>, <C-N>), filenames (<C-X><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><C-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 the word, "first". 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.

Comments

It really does not work in most cases. it used to work before in ver 6.0

It really does work in most cases, and has worked for years. However, the tip was confused and used the wrong keystrokes. Maybe that is your problem. Or maybe your Vim is misconfigured. I have fixed it as best I can in a quick runthrough. It may need a little more work though. --Fritzophrenic 18:57, March 28, 2011 (UTC)

Around Wikia's network

Random Wiki