简体   繁体   中英

vim tab completion for directories

In vim using a command that expects a file I can use tab to cycle through the files in a directory.

If it is currently showing a directory in the "cycle", is there a way to make it so that the next time I tab it will instead cycle through the currently shown directory? What I am currently doing is just pressing space and then backspace but is there a better way to do this?

For example, if I type

:e ~

then when I press tab I will cycle through the directories in my home directory, eg several presses of tab may give me

:e ~/Desktop/
:e ~/Documents/
:e ~/Downloads/

Now for example I may actually want to open a file in ~/Documents, so I'm wondering if there's a way to make it start cycling from ~/Documents/ instead of ~/

Thanks!

Simply hit Down or / when you've reached ~/Documents .
Note that using / will result in ~/Documents// , but completion will still work (ie show items in ~/Documents ).

Edit
You can also use Ctrl - E , which doesn't add the trailing / (and might be easier to type)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM