Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Tab completion in Vim Commands

Tags:

vim

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?

like image 217
Amir Rachum Avatar asked Aug 23 '10 09:08

Amir Rachum


People also ask

How do I use tab AutoComplete in Vim?

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.

How do I enable tab completion?

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.

Does Vim have code completion?

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.

How do you completion a tab in Linux?

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.


1 Answers

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.

like image 190
Eugene Yarmash Avatar answered Sep 28 '22 23:09

Eugene Yarmash