views:

444

answers:

2

To open a file in vim, I usually type ":e " and then hit tab until the file I want appears.

However, I always get in a rhythm and inadvertently go ONE past the desired file. Without knowing how to move backwards, I end up tabbing all the way to the end and repeating the whole process.

Is there a way to perform the filename completion in reverse order?

+4  A: 

Shift-Tab goes backwards.

You can also use set wildmenu to get a list of matching file names above the status bar when you do file name completition with Tab. Then you can select the file name with the arrow keys from this list.

sth
That does not work on my setup: Ubuntu with the standard vim package (Vim 7.1.314) and a basically empty .vimrc. Shift-Tab moves in the same direction as Tab.
I tested it on debian (over ssh using putty), and there it works. I couldn't find any special setting in the config files that explicitly enables this. My guess would be it depends on the terminal if Shift-Tab is sent correctly to the application...
sth
It works fine on Mac OS X (Vim, not gvim, or MacVim) in the terminal.
George V. Reilly
+1  A: 

Shift-Tab and Ctrl-P both go backward.

However Shift-Tab only works with the GUI [1]. Since I am using vim and not gvim, Shift-Tab would not work. Ctrl-P works perfectly.

[1] And on the Amiga and MS-DOS. See ":help cmdline-completion" for more info.