Vim ctrlp仍然搜索被忽略的目录
我试图将忽略的设置放入.vimrc 但是当我使用Vim ctrlp仍然搜索被忽略的目录,vim,ctrlp,Vim,Ctrlp,我试图将忽略的设置放入.vimrc 但是当我使用ctrlp在rails应用程序文件夹下搜索时 它仍在搜索供应商文件夹,因此花费了大量时间 但是搜索完成后,我无法在供应商下搜索任何内容 太奇怪了!如何修复它 这是我的设置文件 当我在.vimrc 217 let g:NERDTreeIgnore=['\~$', 'vendor'] 218 set wildignore+=*\\vendor\\** 当我第一次使用CTRLP在RAILS应用程序文件夹下搜索时,它起了作用, 但是在接下来的时间里,
ctrlp
在rails应用程序文件夹下搜索时
它仍在搜索供应商
文件夹,因此花费了大量时间
但是搜索完成后,我无法在供应商下搜索任何内容
太奇怪了!如何修复它
这是我的设置文件
当我在.vimrc
217 let g:NERDTreeIgnore=['\~$', 'vendor']
218 set wildignore+=*\\vendor\\**
当我第一次使用CTRLP在RAILS应用程序文件夹下搜索时,它起了作用,
但是在接下来的时间里,仍然不起作用
我想可能有一些设置会禁用忽略的设置
下面是我的文件夹的结构
.
├── Gemfile
├── Gemfile.lock
├── README.rdoc
├── Rakefile
├── app
│ ├── assets
│ ├── controllers
│ ├── helpers
│ ├── mailers
│ ├── models
│ ├── uploaders
│ ├── views
│ └── workers
├── auto.sh
├── config
│ ├── application.rb
│ ├── application.yml
│ ├── boot.rb
│ ├── database.yml
│ ├── environment.rb
│ ├── environments
│ ├── initializers
│ ├── locales
│ ├── macbookair_whenever_schedule.rb
│ ├── menu_navigation.rb
│ ├── navigation.rb
│ ├── resque.god
│ ├── resque_schedule.yml
│ ├── routes.rb
│ ├── schedule.rb -> ubuntu_whenever_schedule.rb
│ ├── tinymce.yml
│ └── ubuntu_whenever_schedule.rb
├── config.ru
├── db
│ ├── development.sqlite3
│ ├── migrate
│ ├── migrate_should_be_skip
│ ├── production.sqlite3
│ ├── schema.rb
│ └── seeds.rb
├── doc
│ └── README_FOR_APP
├── lib
│ ├── assets
│ ├── auto_tools
│ ├── tasks
│ └── url_automation_module.rb
├── log
│ ├── apalog
│ ├── development.log
│ ├── passenger.80.log
│ ├── production.log
│ └── prodution.log
├── output_name
├── public
│ ├── 404.html
│ ├── 422.html
│ ├── 500.html
│ ├── exports
│ ├── favicon.ico
│ ├── results.zip
│ ├── robots.txt
│ ├── sandbox
│ └── uploads
├── script
│ ├── delayed_job
│ └── rails
├── test
│ ├── fixtures
│ ├── functional
│ ├── integration
│ ├── performance
│ ├── test_helper.rb
│ └── unit
├── test.sh
├── tmp
│ ├── cache
│ ├── pids
│ ├── restart.txt
│ ├── sessions
│ └── sockets
├── tmplog
└── vendor
└── bundle
您可以使用CtrlP将拾取的wildignore
vim设置
set wildignore+=*\\vendor\\**
如果您键入:help ctrlp options
并阅读一些内容,您将发现:
注#1:默认情况下,wildignore和g:ctrlp\u custom\u ignore
当使用globpath()扫描文件时应用,因此这些选项
当使用g:ctrlp\u user\u命令定义的命令被禁用时,请勿应用该命令
正在使用中
因此,您可能需要取消设置g:ctrlp_user_命令(可能设置为默认命令)以实际使用@TomCammann建议的wildignore
。例如,在~/.vimrc
中添加:
if exists("g:ctrlp_user_command")
unlet g:ctrlp_user_command
endif
set wildignore+=*\\vendor\\**
之后,您需要刷新ctrlp
缓存:在Vim中,在ctrlp
模式下按F5,或运行:CtrlClearAllCaches
,或直接在shell中删除缓存目录:
rm -r ~/.cache/ctrlp/ # On Linux
我的.vimrc文件的一部分。也许会有帮助
set wildignore+=*/.git/*,*/.hg/*,*/.svn/*,*/.idea/*,*/.DS_Store,*/vendor
检查您是否正在使用某些特定的搜索命令,如:
let g:ctrlp_user_command = 'find %s -type f' " MacOSX/Linux
let g:ctrlp_user_command = 'dir %s /-n /b /s /a-d' " Windows
这种配置忽略了g:ctrlp\u custom\u ignore
选项。wildignore
可能被其他命令使用,g:ctrlp\u custom\u ignore
失败的原因是g:ctrlp\u user\u command
,例如,我的:
if executable('rg')
let g:ctrlp_user_command = 'rg %s --files --hidden --color=never --glob ""'
endif
在这种情况下,rg有自己的忽略方式,只需将.git
放到.gitignore
,rg不会在.gitignore
中搜索任何文件。我在你的dir-ignore列表中没有看到供应商
。你使用的插件是否注意g:ctrlp\u custom\u ignore
?在普通vim中,设置这样一个全局变量不会有任何效果。您能在调用vim的目录中给出树的输出吗?我们不知道您的文件夹和文件设置是什么样子,这将有助于我们了解情况。理想情况下,您可以在这里为我们提供完整的输出:您好,您的设置仅在我第一次运行CtrlP
时起作用,在以下时间不起作用。我不知道,这一定是我的问题。加上这一点,我得到了E108:没有这样的变量:“g:ctrlp\u user\u command”
@IanVaughan:你的ctrlp
插件是最新的吗?在我的例子中,这是一个默认值,但如果不是,则需要添加一个防护。检查我的更新答案。如果您已经找到要排除的文件,并且随后试图排除这些文件,则清除缓存非常重要。
if executable('rg')
let g:ctrlp_user_command = 'rg %s --files --hidden --color=never --glob ""'
endif