本文介绍了ctrlp仍然搜索忽略的目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在.vimrc中放置忽略的设置

I tried to put ignored setting in .vimrc

但是当我使用ctrlp在rails应用文件夹下搜索时

But when I used the ctrlp to search under rails app folder

它仍然搜索vendor文件夹,因此花费了大量时间.

It still search the vendor folder, so it took lots of time.

但是搜索完成后,我无法在vendor

But when the search was done, I couldn't search anything under the vendor

真是太奇怪了!如何解决.

It was so strange! How to fix it.

这是我的 .vimrc 设置文件.

http://d.pr/i/yMtK http://d.pr/i/Hy4u

" Sane Ignore For ctrlp
let g:ctrlp_custom_ignore = {
  \ 'dir':  '\.git$|vendor\|\.hg$\|\.svn$\|\.yardoc\|public\/images\|public\/system\|data\|log\|tmp$',
  \ 'file': '\.exe$\|\.so$\|\.dat$'
  \ }

当我在.vimrc

217 let g:NERDTreeIgnore=['\~$', 'vendor']
218 set wildignore+=*\\vendor\\**

当我第一次使用CTRLP在RAILS应用程序文件夹下搜索时,它起作用了,但是NOT仍然在以下时间工作.

It worked when my first time to use the CTRLP to search under the RAILS app folder,But still NOT worked in the following times.

我想也许有些设置会禁用忽略的设置?

I guess maybe there are some settings will disable the ignored setting ?

这是我的文件夹的结构

.
├── 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

推荐答案

如果您键入:help ctrlp-options并阅读了一下,就会发现:

If you type :help ctrlp-options and read a bit, you will find:

因此,您可能需要unlet g:ctrlp_user_command(可能设置为默认命令)才能按照@TomCammann的建议实际使用wildignore.例如,在您的~/.vimrc中,添加:

Thus, you may need to unlet g:ctrlp_user_command (possibly set to a default command) to actually use wildignore as advised by @TomCammann. For instance, in your ~/.vimrc, add:

if exists("g:ctrlp_user_command")
  unlet g:ctrlp_user_command
endif
set wildignore+=*\\vendor\\**

此后,您需要刷新ctrlp缓存:在Vim中,以ctrlp模式按,或运行:CtrlPClearAllCaches,或直接在您的Shell中删除缓存目录:

After that, you need to refresh your ctrlp cache: in Vim, press in ctrlp mode, or run :CtrlPClearAllCaches, or remove the cache directory directly in your shell:

rm -r ~/.cache/ctrlp/      # On Linux

这篇关于ctrlp仍然搜索忽略的目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-25 03:57