When I'm opening a new file in vim and I use tab completion, it completes the whole file name instead of doing the partial match like bash does. Is there an option to make this file name tab completion work more like bash?
views:
1540answers:
4I'm assuming that you are using autocomplete in vim via Ctrl-n to search through the current buffer. When you use this command, you get a list of solutions, simply repeat the command to go to the next item in the list. The same is true for all autocomplete commands. While they fill in the entire word, you can continue to move through the list until you arrive at the one you wish to use.
Hope this is helpful.
Edit 1: This may be a more useful command: Ctrl+p. The only difference is that Ctrl+p searches backwards in the buffer while Ctrl+n searches forwards... Realistically, they will both provide a list with the same elements, they may just appear in a different order.
I personally use
set wildmode=longest,list,full
set wildmenu
When you type the first tab hit 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
bash like would be just
set wildmode=longest,list
but the full is very handy
If you don't want to set the wildmenu, you can always press Ctrl-L when you want to open a file. Ctrl-L will complete the filename like bash completion.