vim 的 ido 模式文件名?
我严格使用 vim,但我在玩 emacs,并且在打开文件时非常喜欢 ido 模式。只需开始输入文件名的一部分,它就会缩小搜索范围,当您想要的文件位于列表前面时,只需按 Enter 键即可。 vim 有类似的东西吗?我一直在寻找但没有运气。
谢谢
I strictly use vim, but I was playing with emacs and really like ido-mode when opening files. just start typing part of a filename and it narrows down the search and just press enter when the file you want is at the front of the list. is there anything similar for vim? i've been searching with no luck.
thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
vim 具有文件名的制表符补全功能,但不幸的是,它会显示整个第一个匹配项,而不是像 bash 制表符补全那样在出现歧义时停止。
vim has tab completion of file names, but unfortunately it shows the entire first match instead of just stopping when it reaches an ambiguity like bash tab completion does.
我有同样的问题,解决方案是“:help wildmode”。我个人使用
I have the same problem and the solution is ":help wildmode". I personally use
根据您想要完成的内容,您有以下选项:
如果您想完成从 $HOME、/etc 或其他包含许多文件的目录开始的文件名,您可以尝试 fuzzyfinder (由 @michael 提到)或我的 zvim 插件(整个插件是 alpha,但是
:ZEdit
和:ZView
命令足够稳定)。使用我的插件,您将获得类似 zsh 的完成,这并不完全符合您的要求,但它很好。示例:将扩展为(使用
&wildmode="longest,list:full"
)当然,它要求您知道
z.vim
(或您想要查找的任何内容)所在的位置。// 要安装 zvim,请安装 vim-addon-manager和 Mercurial 并将
call scriptmanager#Activate(["zvim"])
行添加到您的 vimrc。如果你想查找项目文件(当前目录下的文件),请尝试 命令-T 插件。它需要 ruby 支持和索引文件,因此不能用于从主目录开始查找文件。
Depending on what do you want to complete, you have the following options:
If you want to complete filenames starting from $HOME, /etc or other directories that contain many files, you can try fuzzyfinder (mentioned by @michael) or my zvim plugin (whole plugin is alpha, but
:ZEdit
and:ZView
commands are stable enough). With my plugin you will get zsh-like completion that is not exactly what you asked, but it is good. Example:will expand to (with
&wildmode="longest,list:full"
)Of course, it require you to know where
z.vim
(or whatever you want to find) is located.// To install zvim, install vim-addon-manager and mercurial and add
call scriptmanager#Activate(["zvim"])
line to your vimrc.If you want to find project files (files under current directory), try Command-T plugin. It requires ruby support and indexes files, so it cannot be used to find files starting from home directory.
我认为插件“command-t”可能就是您正在寻找的:
https://wincent.com/products/command-t
http://www.vim.org/scripts/script.php?script_id=3025
该插件将 t 映射到一个函数,该函数打开一个带有过滤文件列表的窗口。当您开始输入时,文件会被实时过滤,您可以按 Enter 键选择最上面的文件。
I think the plugin 'command-t' might be what you're looking for:
https://wincent.com/products/command-t
http://www.vim.org/scripts/script.php?script_id=3025
This plugin maps t to a function which opens a window with a filtered list of files. When you start typing, the files are filtered in realtime, and you can press enter to select the topmost file.
有一些很好的快速文件查找器插件,例如 fuzzyfinder http://www.vim.org /scripts/script.php?script_id=1984 可以增强您的体验。 (Fuzzy Finder 似乎做了不明确的选择)
另外,您可能想查看一下 Wildmode 调整选项 ala :he Wildmode
我在这里解释的方法并没有达到模糊的技巧,但它是选项卡友好的。
如何让 vim 对文件名执行正常(类似 bash)的制表符补全?
Theres some good quick file finder plugins like fuzzyfinder http://www.vim.org/scripts/script.php?script_id=1984 that could enhance your experience. (Fuzzy Finder seems to do ambiguous selection)
Also you might want to look at wildmode tweaks options ala :he wildmode
The method I explained here doesnt to the ambigous trick but it is tab friendly.
How do I make vim do normal (bash like) tab completion for file names?