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
endif
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 = [
\ 'root.dir',
\ '.vimprojects',
@ -640,6 +640,11 @@ func! ctrlp#SetWorkingPath(...)
\ '.hg/',
\ '.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
sil! cal s:FindRoot(getcwd(), marker)
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)
<
*'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'*
Set the maximum height of the match window: >
let g:ctrlp_max_height = 10