1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-01-23 17:20:04 +08:00
SpaceVim/config/plugins/ctrlp.vim

69 lines
3.0 KiB
VimL
Raw Normal View History

"=============================================================================
" ctrlp.vim --- ctrlp config
2023-03-26 13:44:47 +08:00
" Copyright (c) 2016-2023 Wang Shidong & Contributors
" Author: Wang Shidong < wsdjeg@outlook.com >
" URL: https://spacevim.org
" License: GPLv3
"=============================================================================
2018-12-09 10:04:55 +08:00
let s:SYS = SpaceVim#api#import('system')
2017-03-21 20:40:11 +08:00
let g:ctrlp_map = get(g:,'ctrlp_map', '<c-p>')
let g:ctrlp_cmd = get(g:, 'ctrlp_cmd', 'CtrlP')
let g:ctrlp_working_path_mode = get(g:, 'ctrlp_working_path_mode', 'ra')
2021-02-21 15:56:37 +08:00
let g:ctrlp_root_markers = get(g:, 'ctrlp_root_markers', get(g:, 'spacevim_project_rooter_patterns', ''))
let g:ctrlp_match_window = get(g:, 'ctrlp_match_window', 'bottom,order:btt,min:1,max:15,results:15')
let g:ctrlp_show_hidden = get(g:, 'ctrlp_show_hidden', 1)
2016-12-26 21:11:19 +08:00
"for caching
let g:ctrlp_use_caching = get(g:, 'ctrlp_use_caching', 500)
let g:ctrlp_clear_cache_on_exit = get(g:, 'ctrlp_clear_cache_on_exit', 1)
2021-08-18 20:54:54 +08:00
let g:ctrlp_cache_dir = get(g:, 'ctrlp_cache_dir', get(g:, 'spacevim_data_dir', '~') . 'ctrlp')
2016-12-26 21:11:19 +08:00
"let g:ctrlp_map = ',,'
"let g:ctrlp_open_multiple_files = 'v'
"if you have install ag, the g:ctrlp_custom_ignore will not work
let g:ctrlp_custom_ignore = get(g:, 'ctrlp_custom_ignore', {
\ 'dir': '\v[\/]\.(git|hg|svn)$|target|node_modules|te?mp$|logs?$|public$|dist$',
\ 'file': '\v\.(exe|so|dll|ttf|png|gif|jpe?g|bpm)$|\-rplugin\~',
2017-03-06 23:26:26 +08:00
\ 'link': 'some_bad_symbolic_links',
\ })
2017-03-28 23:46:06 +08:00
if executable('rg') && !exists('g:ctrlp_user_command')
let g:ctrlp_user_command = 'rg %s --hidden --files -g "" '
\ . join(SpaceVim#util#Generate_ignore(get(g:, 'spacevim_wildignore', ''),'rg', SpaceVim#api#import('system').isWindows ? 0 : 1))
2017-03-28 23:46:06 +08:00
elseif executable('ag') && !exists('g:ctrlp_user_command')
2020-08-29 16:46:57 +08:00
let g:ctrlp_user_command = 'ag --hidden -i -g "" ' . join(SpaceVim#util#Generate_ignore(get(g:, 'spacevim_wildignore', &wildignore),'ag')) . ' %s'
2018-12-09 10:04:55 +08:00
elseif s:SYS.isWindows
let g:ctrlp_user_command =
\ 'dir %s /-n /b /s /a-d | findstr /v /l ".jpg \\tmp\\"' " Windows
elseif s:SYS.isOSX
let g:ctrlp_user_command =
\ 'find %s -type f | grep --invert-match --extended-regexp "\.jpg$|/tmp/"' " MacOSX
2018-12-09 10:04:55 +08:00
else
let g:ctrlp_user_command =
\ 'find %s -type f | grep -v -P "\.jpg$|/tmp/"' " Linux
2016-12-26 21:11:19 +08:00
endif
2017-03-28 23:46:06 +08:00
if !exists('g:ctrlp_match_func') && (has('python') || has('python3'))
let g:ctrlp_match_func = { 'match': 'pymatcher#PyMatch' }
endif
let g:ctrlp_funky_syntax_highlight = get(g:, 'ctrlp_funky_syntax_highlight', 1)
2016-12-26 21:11:19 +08:00
" }}}
"for ctrlp_nerdtree {{{
let g:ctrlp_nerdtree_show_hidden = get(g:, 'ctrlp_nerdtree_show_hidden', 1)
2016-12-26 21:11:19 +08:00
"}}}
"for ctrlp_sessions{{{
let g:ctrlp_extensions = ['funky', 'sessions' , 'k' , 'tag', 'mixed', 'quickfix', 'undo', 'line', 'changes', 'cmdline', 'menu']
"}}}
2016-12-26 21:11:19 +08:00
""for ctrlp-cmatcher {{{
"let g:ctrlp_max_files = 0
"let g:ctrlp_match_func = {'match' : 'matcher#cmatch' }
""}}}
augroup Fix_command_in_help_buffer
2017-03-06 23:26:26 +08:00
au!
autocmd FileType help exec 'nnoremap <buffer><silent><c-p> :<c-u>CtrlP ' . getcwd() .'<cr>'
2016-12-26 21:11:19 +08:00
augroup END
2017-03-06 23:26:26 +08:00
" vim:set et sw=2: