I want to ignore dist
, .git
directories for ctrlp.vim. And my .vimrc
configure is below:
let g:ctrlp_custom_ignore = {
\ 'dir': '\v[\/](\.git|dist)$'
}
I have two questions:
dist
directory. \v
mean in the
statement?PS: This is my ctrlp configure of .vimrc
""" ctrlp
let g:ctrlp_use_caching = 1
let g:ctrlp_clear_cache_on_exit = 0
let g:ctrlp_cache_dir = '$HOME/.vim/cache/ctrlp'
let g:ctrlp_max_files = 1000
let g:ctrlp_max_history = &history
let g:ctrlp_max_depth = 10
let g:ctrlp_user_command = [
\ '.git', 'cd %s && git ls-files . -co --exclude-standard',
\ 'rg %s --files --color=never --glob ""',
\ 'find %s -type f'
\ ]
let g:ctrlp_custom_ignore = {
\ 'dir': '\v[\/](\.git\|dist)$',
\ 'file': '\v\.(exe|so|dll)$',
\ }
"let g:ctrlp_custom_ignore = 'dist'
" let g:ctrlp_user_command = ['rg --files']
let g:ctrlp_working_path_mode = 'ra'
let g:ctrlp_reuse_window = 'startify'
map ff :CtrlP<cr>
Answer 1:
Please add following line in your .vimrc
let g:ctrlp_custom_ignore = 'dist'
I placed this line at last position in .vimrc
Answer 2:
\v
search for "one vertical whitespace character: line feed, carriage return, vertical tab, form feed, paragraph or line separator".
For details visit rexegg.
Vim's regexes are unfortunately not like any other systems, making them cumbersome and painful to work with. I'm not sure if CtrlP's ignore supports \v,
I wouldn't add it here. I would also remove the leading slash. Try this (and restarting Vim):
let g:ctrlp_custom_ignore = {
\ 'dir': '\.git\|dist$'
\ }
The \v
is the "very magic" switch, which you should always use for searching in Vim (again, unsure if CtrlP supports it), to make them more usable:
nnoremap / /\v
It makes special characters like +
behave like normal regex characters, instead of poorly defined Vim regex characters.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With