Vim Tips Wiki
Explore
Main Page
All Pages
Community
Interactive Maps
Community portal
To do
FANDOM
Fan Central
BETA
Games
Anime
Movies
TV
Video
Wikis
Explore Wikis
Community Central
Start a Wiki
Don't have an account?
Register
Sign In
Sign In
Register
Vim Tips Wiki
1,649
pages
Explore
Main Page
All Pages
Community
Interactive Maps
Community portal
To do
Editing
Line/word/file/whatever completion
Back to page
Edit
Edit source
View history
Talk (0)
Edit Page
Line/word/file/whatever completion
We recommend that you
log in
before editing. This will allow other users to leave you a message about your edit, and will let you track edits via your
Watchlist
.
Creating an account
is quick and free.
The edit appears to have already been undone.
Anti-spam check. Do
not
fill this in!
{{TipImported |id=295 |previous=294 |next=297 |created=2002 |complexity=intermediate |author=Nopik |version=6.0 |rating=64/30 |category1=Completion |category2= }} 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> this is first line second line is here </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>. 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==
Summary:
Please note that all contributions to the Vim Tips Wiki are considered to be released under the CC-BY-SA
Cancel
Editing help
(opens in new window)
Templates used on this page:
Template:Help
(
view source
)
Template:Navigation
(
view source
)
Template:TipImported
(
view source
)
Follow on IG
TikTok
Join Fan Lab