当我用 command-T 搜索某个文件时,它经常找不到它,因为我不在正确的目录中,所以我必须更改目录。
是否可以设置 command-T 将首先在书签Nerdtree
或其他地方的目录中搜索?
我可以将目录更改为/
但此搜索范围非常大的文件。当我将目录更改为我的主目录并且我正在寻找一些普通的东西时,.bashrc
我会发现相当多的文件位于.wine
目录下。
在 99% 的时间里,我需要在我积极使用的项目目录中搜索文件。我可以在某些首选项中设置这些目录吗?
当我用 command-T 搜索某个文件时,它经常找不到它,因为我不在正确的目录中,所以我必须更改目录。
是否可以设置 command-T 将首先在书签Nerdtree
或其他地方的目录中搜索?
我可以将目录更改为/
但此搜索范围非常大的文件。当我将目录更改为我的主目录并且我正在寻找一些普通的东西时,.bashrc
我会发现相当多的文件位于.wine
目录下。
在 99% 的时间里,我需要在我积极使用的项目目录中搜索文件。我可以在某些首选项中设置这些目录吗?
根据文档,您可以从搜索中排除目录:
*command-t-wildignore* |'wildignore'| string (default: '') Vim's |'wildignore'| setting is used to determine which files should be excluded from listings. This is a comma-separated list of glob patterns. It defaults to the empty string, but common settings include "*.o,*.obj" (to exclude object files) or ".git,.svn" (to exclude SCM metadata directories). For example: :set wildignore+=*.o,*.obj,.git A pattern such as "vendor/rails/**" would exclude all files and subdirectories inside the "vendor/rails" directory (relative to directory Command-T starts in).
所以如果你想排除一个备份目录,你会写:
set wildignore+=project/backup
在你的 .vimrc
此外,要忽略 dotfiles/dotdirs,您可以查看以下选项:
g:CommandTNeverShowDotFiles
g:CommandTScanDotDirectories
g:CommandTMaxDepth
这些允许您:
- 完全忽略点文件;
- 停止在 dotdirs 中递归搜索;
- 指定 Command-T 应在什么深度停止扫描。
我在作者的 git中找到了这个信息,但是你可以通过在 vim 中发出来看到这个文档:
:help Command-T
(或类似名称)
我没有在插件中看到任何对首选项或书签的引用。
但是,如果您通过在所述项目目录中打开一个文件来启动 vim,您可能希望将此行添加到您的 .vimrc 中:
set autochdir
此选项将在启动时将您的目录设置为当前文件的目录。
你可以试试Ctrl-P。我遇到了和你一样的问题,做出改变解决了这些问题。
我也忽略了一些文件夹(在 .vimrc 中):
let g:ctrlp_custom_ignore = {
\ 'dir': '\.git$\|\.hg$\|\.svn$',
\ 'file': '\.exe$\|\.so$\|\.dll$' }