(adjust previous/next navigation + minor manual clean) |
JohnBeckett (talk | contribs) (Reword.) |
||
(One intermediate revision by one other user not shown) | |||
Line 11: | Line 11: | ||
|category2= |
|category2= |
||
}} |
}} |
||
− | In addition to [[VimTip4|any word completion]] you can use |
+ | In addition to [[VimTip4|any word completion]] you can use Ctrl-X completion mode to complete whole lines, filenames, keywords, and more. While entering text in insert mode, press Ctrl-X (written as <C-X> below), then another key to indicate the type of completion. |
+ | |||
+ | *<C-X><C-L> complete whole lines |
||
+ | *<C-X><C-P> complete words (<C-P> has the same effect; <C-X> is not needed) |
||
+ | *<C-X><C-F> complete file names |
||
+ | *<C-X><code>s</code> spelling suggestions (after <code>:setl spell</code> to enable spell checking) |
||
+ | |||
+ | While completion is active, type <C-P> or <C-N> to select the previous or next item. |
||
+ | |||
+ | For more information, see {{help|ins-completion}}. |
||
+ | |||
+ | ==Example== |
||
+ | For example, suppose the following text is entered: |
||
<pre> |
<pre> |
||
this is first line |
this is first line |
||
Line 17: | Line 29: | ||
</pre> |
</pre> |
||
+ | With the cursor on the empty third line, and while still in insert mode, pressing <C-X><C-L> will insert a copy of the second line. Select another line with <C-P> or <C-N>. |
||
− | 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. |
||
+ | |||
+ | If "th" is typed at the start of the third line, pressing <C-X><C-L> will insert the first line because it starts with "th". |
||
+ | |||
+ | As an example of word completion, suppose "f" is typed at the start of the third line. Press <C-P> to complete the word using the previous occurrence that starts with "f"—that will insert "first". If you then press <C-X><C-P> the following word will also be inserted (the result will be "first line"). |
||
==Comments== |
==Comments== |
Latest revision as of 08:00, 17 May 2014
created 2002 · complexity intermediate · author Nopik · version 6.0
In addition to any word completion you can use Ctrl-X completion mode to complete whole lines, filenames, keywords, and more. While entering text in insert mode, press Ctrl-X (written as <C-X> below), then another key to indicate the type of completion.
- <C-X><C-L> complete whole lines
- <C-X><C-P> complete words (<C-P> has the same effect; <C-X> is not needed)
- <C-X><C-F> complete file names
- <C-X>
s
spelling suggestions (after:setl spell
to enable spell checking)
While completion is active, type <C-P> or <C-N> to select the previous or next item.
For more information, see :help ins-completion.
Example[]
For example, suppose the following text is entered:
this is first line second line is here
With the cursor on the empty third line, and while still in insert mode, pressing <C-X><C-L> will insert a copy of the second line. Select another line with <C-P> or <C-N>.
If "th" is typed at the start of the third line, pressing <C-X><C-L> will insert the first line because it starts with "th".
As an example of word completion, suppose "f" is typed at the start of the third line. Press <C-P> to complete the word using the previous occurrence that starts with "f"—that will insert "first". If you then press <C-X><C-P> the following word will also be inserted (the result will be "first line").