Support multiple user commands
Support defining multiple user VCS commands with g:ctrlp_user_command following this format: let g:ctrlp_user_command = { \ 'types': { \ 1: [root_marker_1, listing_command_1], \ n: [root_marker_n, listing_command_n], \ }, \ 'fallback': fallback_command \ } Check the docs for a working example (:help ctrlp_user_command). Refs #118
This commit is contained in:
parent
2d90da985d
commit
6a9f1e3a46
@ -218,13 +218,13 @@ fu! s:Files()
|
||||
" Remove base directory
|
||||
cal ctrlp#rmbasedir(g:ctrlp_allfiles)
|
||||
let read_cache = 0
|
||||
if len(g:ctrlp_allfiles) <= s:compare_lim
|
||||
cal sort(g:ctrlp_allfiles, 'ctrlp#complen')
|
||||
en
|
||||
el
|
||||
let g:ctrlp_allfiles = ctrlp#utils#readfile(cafile)
|
||||
let read_cache = 1
|
||||
en
|
||||
if len(g:ctrlp_allfiles) <= s:compare_lim
|
||||
cal sort(g:ctrlp_allfiles, 'ctrlp#complen')
|
||||
en
|
||||
cal s:writecache(read_cache, cafile)
|
||||
retu g:ctrlp_allfiles
|
||||
endf
|
||||
@ -266,9 +266,20 @@ fu! s:lsCmd()
|
||||
" Try the secondary_command
|
||||
retu len(cmd) == 3 ? cmd[2] : ''
|
||||
en
|
||||
unl! s:vcsroot
|
||||
unl s:vcsroot
|
||||
let s:vcscmd = s:lash == '\' ? 1 : 0
|
||||
retu cmd[1]
|
||||
elsei type(cmd) == 4 && has_key(cmd, 'types')
|
||||
for key in sort(keys(cmd['types']), 's:compval')
|
||||
cal s:findroot(getcwd(), cmd['types'][key][0], 0, 1)
|
||||
if exists('s:vcsroot') | brea | en
|
||||
endfo
|
||||
if !exists('s:vcsroot')
|
||||
retu has_key(cmd, 'fallback') ? cmd['fallback'] : ''
|
||||
en
|
||||
unl s:vcsroot
|
||||
let s:vcscmd = s:lash == '\' ? 1 : 0
|
||||
retu cmd['types'][key][1]
|
||||
en
|
||||
endf
|
||||
fu! s:Buffers() "{{{1
|
||||
@ -944,6 +955,10 @@ fu! s:mixedsort(s1, s2)
|
||||
en
|
||||
retu 2 * cml + cln
|
||||
endf
|
||||
|
||||
fu! s:compval(...)
|
||||
retu a:1 - a:2
|
||||
endf
|
||||
" Statusline {{{2
|
||||
fu! ctrlp#statusline()
|
||||
if !exists('s:statypes')
|
||||
@ -1126,8 +1141,8 @@ fu! s:syntax()
|
||||
sy match CtrlPNoEntries '^ == NO ENTRIES ==$'
|
||||
sy match CtrlPLinePre '^>'
|
||||
hi link CtrlPNoEntries Error
|
||||
if exists('g:colors_name')
|
||||
exe 'hi CtrlPLinePre '.( has("gui_running") ? 'gui' : 'cterm' ).'fg=bg'
|
||||
if hlexists('Normal')
|
||||
sil! exe 'hi CtrlPLinePre '.( has("gui_running") ? 'gui' : 'cterm' ).'fg=bg'
|
||||
en
|
||||
endf
|
||||
|
||||
|
@ -57,13 +57,13 @@ fu! ctrlp#dir#init(...)
|
||||
cal s:globdirs(s:cwd, 0)
|
||||
cal ctrlp#rmbasedir(g:ctrlp_alldirs)
|
||||
let read_cache = 0
|
||||
if len(g:ctrlp_alldirs) <= s:compare_lim
|
||||
cal sort(g:ctrlp_alldirs, 'ctrlp#complen')
|
||||
en
|
||||
el
|
||||
let g:ctrlp_alldirs = ctrlp#utils#readfile(cafile)
|
||||
let read_cache = 1
|
||||
en
|
||||
if len(g:ctrlp_alldirs) <= s:compare_lim
|
||||
cal sort(g:ctrlp_alldirs, 'ctrlp#complen')
|
||||
en
|
||||
if !read_cache
|
||||
cal ctrlp#utils#writecache(g:ctrlp_alldirs, cadir, cafile)
|
||||
let g:ctrlp_newdir = 0
|
||||
|
@ -147,7 +147,7 @@ only need to keep the lines that you’ve changed the values (inside []): >
|
||||
\ 'ToggleType(1)': ['<c-f>', '<c-up>'],
|
||||
\ 'ToggleType(-1)': ['<c-b>', '<c-down>'],
|
||||
\ 'PrtExpandDir()': ['<tab>', '<c-i>'],
|
||||
\ 'PrtInsert("w")': ['<F2>'],
|
||||
\ 'PrtInsert("w")': ['<F2>', '<insert>'],
|
||||
\ 'PrtInsert("s")': ['<F3>'],
|
||||
\ 'PrtInsert("v")': ['<F4>'],
|
||||
\ 'PrtInsert("+")': ['<F6>'],
|
||||
@ -239,7 +239,7 @@ Examples: >
|
||||
let g:ctrlp_custom_ignore = {
|
||||
\ 'dir': '\.git$\|\.hg$\|\.svn$',
|
||||
\ 'file': '\.exe$\|\.so$\|\.dll$',
|
||||
\ 'link': 'some$\|bad$\|symbolic$\|links$',
|
||||
\ 'link': 'SOME_BAD_SYMBOLIC_LINKS',
|
||||
\ }
|
||||
<
|
||||
|
||||
@ -276,14 +276,28 @@ Examples: >
|
||||
<
|
||||
Use a version control listing command when inside a repository, this is faster
|
||||
when scanning large projects: >
|
||||
let g:ctrlp_user_command = [repo_marker, vcs_ls_command, fallback_command]
|
||||
let g:ctrlp_user_command = [root_marker, listing_command, fallback_command]
|
||||
let g:ctrlp_user_command = {
|
||||
\ 'types': {
|
||||
\ 1: [root_marker_1, listing_command_1],
|
||||
\ n: [root_marker_n, listing_command_n],
|
||||
\ },
|
||||
\ 'fallback': fallback_command
|
||||
\ }
|
||||
<
|
||||
If the fallback_command is empty or not defined, |globpath()| will then be used
|
||||
when searching outside a repo.
|
||||
Examples: >
|
||||
let g:ctrlp_user_command = ['.git/', 'cd %s && git ls-files']
|
||||
let g:ctrlp_user_command = ['.hg/', 'hg --cwd %s locate -I .']
|
||||
let g:ctrlp_user_command = {
|
||||
\ 'types': {
|
||||
\ 1: ['.git/', 'cd %s && git ls-files'],
|
||||
\ 2: ['.hg/', 'hg --cwd %s locate -I .'],
|
||||
\ },
|
||||
\ 'fallback': 'find %s -type f'
|
||||
\ }
|
||||
<
|
||||
If the fallback_command is empty or not defined, |globpath()| will then be used
|
||||
when searching outside a repo.
|
||||
|
||||
*'g:ctrlp_max_history'*
|
||||
The maximum number of input strings you want |CtrlP| to remember. The default
|
||||
|
Loading…
Reference in New Issue
Block a user