Vim CtrlP 插件 : Manually set root search directory?

标签 vim vim-plugin

我已通读文档,但无法确定这是否可行。

我想保留默认设置 g:ctrlp_working_path_mode = 2 ,但如果我愿意,我希望能够手动覆盖当前窗口中的所有缓冲区。

具体来说,我想发出一个 ctrlp 命令或更改一个设置根搜索目录的 ctrlp 配置变量,这样无论我位于哪个缓冲区,都使用该目录进行所有 future 的搜索。

额外问题:是否可以设置两个根目录,以便搜索这两个目录并合并结果?

谢谢!

最佳答案

试试这个:

let g:ctrlp_working_path_mode = 'ra'

'c' - the directory of the current file.

'r' - the nearest ancestor that contains one of these directories or files: .git .hg .svn .bzr

'a' - like c, but only if the current working directory outside of CtrlP is not a direct ancestor of the directory of the current file.

0 or '' (empty string) - disable this feature.

来源:https://github.com/kien/ctrlp.vim

此外,这里:https://github.com/kien/ctrlp.vim/issues/292 ,作者提供了一种设置fullpath的方法:

:CtrlP /var/www/myproject/bla/bla/theme

关于Vim CtrlP 插件 : Manually set root search directory?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11873736/

相关文章:

git - 将 vim 当前工作目录设置为当前项目根目录或当前文件所在目录

vim - 插件是由vimrc加载还是之后加载?

Vim 绑定(bind)将光标下的单词括在双花括号中

ruby - 如何在一行中搜索和替换多个项目?

Vim 魔法来做到这一点

linux - vim 和 sudo 可执行文件的路径

vim - 如何为 Vim 安装 Gist 插件?

vim - 当我使用 Janus vim 处理 golang 文件时,如何在 Vim 中删除此消息?

git - 尝试执行基本 git 操作时获取 "Vim: Caught deadly signal ILL"

Vim - 在可视模式下复制/粘贴时保留最后复制的文本