When I type a command in Vim, for example opening a file, I start to type the file name, and I want to press Tab and have Vim autocomplete the name. However, when I press Tab, vim puts in ^I
for some reason.
How can I make Vim tab complete?
When you type the first tab hit, it will complete as much as possible. The second tab hit will provide a list. The third and subsequent tabs will cycle through completion options so you can complete the file without further keys.
To use tab completion, you first set the preferences. In Version 6.5 (Release 13), select File > Preferences > Command Window > Keyboard and Indenting. Under the Tab key, select the checkbox for Enable up to n tab completions.
To initiate code completion enter insert mode and type Ctrl-X Ctrl-U . By default Vim will open a popup if there is more than one completion. When using omnifunc you will use Ctrl-X Ctrl-O to start code completion.
Command-line completion allows the user to type the first few characters of a command, program, or filename, and press a completion key (normally Tab ↹ ) to fill in the rest of the item. The user then presses Return or ↵ Enter to run the command or open the file.
The character which starts command-line completion defaults to Tab only when nocompatible
is set. In Vi compatible mode it's CTRL-E.
This is documented in :h cmdline-completion.
You can set nocompatible
in your .vimrc file to make it work as expected.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With