optional root markers

This commit is contained in:
Kien N 2011-09-06 20:03:31 +07:00
parent 5ae7572934
commit 8d1ec536d3
2 changed files with 12 additions and 1 deletions

View File

@ -631,7 +631,7 @@ func! ctrlp#SetWorkingPath(...)
se noacd se noacd
endif endif
sil! exe 'chdir' fnameescape(expand('%:p:h')) sil! exe 'chdir' fnameescape(expand('%:p:h'))
if s:pathmode || l:pathmode | retu | endif if s:pathmode == 1 || l:pathmode == 1 | retu | endif
let markers = [ let markers = [
\ 'root.dir', \ 'root.dir',
\ '.vimprojects', \ '.vimprojects',
@ -640,6 +640,11 @@ func! ctrlp#SetWorkingPath(...)
\ '.hg/', \ '.hg/',
\ '.bzr/', \ '.bzr/',
\ ] \ ]
if exists('g:ctrlp_root_markers')
\ && type(g:ctrlp_root_markers) == 3
\ && !empty(g:ctrlp_root_markers)
let markers = g:ctrlp_root_markers
endif
for marker in markers for marker in markers
sil! cal s:FindRoot(getcwd(), marker) sil! cal s:FindRoot(getcwd(), marker)
if getcwd() != expand('%:p:h') | break | endif if getcwd() != expand('%:p:h') | break | endif

View File

@ -92,6 +92,12 @@ to your |.vimrc|; the parameter is the same (1, 2 and 0): >
au BufEnter * cal ctrlp#SetWorkingPath(2) au BufEnter * cal ctrlp#SetWorkingPath(2)
< <
*'g:ctrlp_root_markers'*
Use this to set your own root markers for the SetWorkingPath() function instead
of the default ones: >
let g:ctrlp_root_markers = ['']
<
*'g:ctrlp_max_height'* *'g:ctrlp_max_height'*
Set the maximum height of the match window: > Set the maximum height of the match window: >
let g:ctrlp_max_height = 10 let g:ctrlp_max_height = 10