Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
641 views
in Technique[技术] by (71.8m points)

vim - ctrlp still searches the ignored directory

I tried to put ignored setting in .vimrc

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

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

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

It was so strange! How to fix it.

Here is my .vimrc setting file.

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$'
   }

When I appended the code in the end of .vimrc

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

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 ?

Here are the structure of my folder

.
├── 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
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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

Note #1: by default, wildignore and g:ctrlp_custom_ignore only apply when globpath() is used to scan for files, thus these options do not apply when a command defined with g:ctrlp_user_command is being used.

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\**

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

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...