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:
- It does not ignore the
dist
directory. - What is the
\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>
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):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:It makes special characters like
+
behave like normal regex characters, instead of poorly defined Vim regex characters.