简体   繁体   English

目录的vim选项卡完成

[英]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. 在vim中使用期望文件的命令,我可以使用tab循环浏览目录中的文件。

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? 如果当前在“循环”中显示目录,是否有一种方法可以使它下次在我按Tab时循环显示当前显示的目录? 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 然后当我按Tab时,我将循环浏览主目录中的目录,例如,几次按Tab可能会给我

: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 ~/ 现在,例如,我实际上可能想在〜/ Documents中打开一个文件,所以我想知道是否有办法使它从〜/ Documents /而不是〜/开始循环。

Thanks! 谢谢!

Simply hit Down or / when you've reached ~/Documents . 到达~/Documents时,只需按Down/
Note that using / will result in ~/Documents// , but completion will still work (ie show items in ~/Documents ). 请注意,使用/将导致~/Documents// ,但是补全仍将起作用(即,在~/Documents显示项目)。

Edit 编辑
You can also use Ctrl - E , which doesn't add the trailing / (and might be easier to type) 您还可以使用Ctrl-E ,它不会添加结尾的/ (并且可能更容易键入)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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