Change working_path_mode option's default value

This commit is contained in:
Kien N 2012-09-03 23:09:25 +07:00
parent 309d29d0c7
commit 4557b5e542
4 changed files with 15 additions and 11 deletions

View File

@ -83,7 +83,7 @@ let [s:pref, s:opts, s:new_opts] = ['g:ctrlp_', {
\ 'use_caching': ['s:caching', 1], \ 'use_caching': ['s:caching', 1],
\ 'use_migemo': ['s:migemo', 0], \ 'use_migemo': ['s:migemo', 0],
\ 'user_command': ['s:usrcmd', ''], \ 'user_command': ['s:usrcmd', ''],
\ 'working_path_mode': ['s:pathmode', 'rc'], \ 'working_path_mode': ['s:pathmode', 'ra'],
\ }, { \ }, {
\ 'open_multiple_files': 's:opmul', \ 'open_multiple_files': 's:opmul',
\ 'regexp': 's:regexp', \ 'regexp': 's:regexp',
@ -827,7 +827,8 @@ fu! s:SetWD(args)
cal ctrlp#setdir(a:args['dir']) | retu cal ctrlp#setdir(a:args['dir']) | retu
en en
if s:crfile =~ '^.\+://' | retu | en if s:crfile =~ '^.\+://' | retu | en
if pmode =~ 'c' || ( !type(pmode) && pmode ) if pmode =~ 'c' || ( pmode =~ 'a' && stridx(s:crfpath, s:cwd) < 0 )
\ || ( !type(pmode) && pmode )
if exists('+acd') | let [s:glb_acd, &acd] = [&acd, 0] | en if exists('+acd') | let [s:glb_acd, &acd] = [&acd, 0] | en
cal ctrlp#setdir(s:crfpath) cal ctrlp#setdir(s:crfpath)
en en

View File

@ -163,18 +163,19 @@ Where to put the new tab page when opening one: >
*'g:ctrlp_working_path_mode'* *'g:ctrlp_working_path_mode'*
When starting up, CtrlP sets its local working directory according to this When starting up, CtrlP sets its local working directory according to this
variable: > variable: >
let g:ctrlp_working_path_mode = 'rc' let g:ctrlp_working_path_mode = 'ra'
< <
c - the directory of the current file. c - the directory of the current file.
r - the nearest ancestor that contains one of these directories or files: r - the nearest ancestor that contains one of these directories or files:
.git .hg .svn .bzr _darcs .git .hg .svn .bzr _darcs
a - like c, but only if the current working directory outside of CtrlP is not
a direct ancestor of the directory of the current file.
0 or <empty-string> - don't manage working directory. 0 or <empty-string> - don't manage working directory.
Note #1: you can use b:ctrlp_working_path_mode (a |b:var|) to set this option Note #1: you can use b:ctrlp_working_path_mode (a |b:var|) to set this option
on a per buffer basis. on a per buffer basis.
Note #2: with both 'r' and 'c' in the option, when a root isn't found, use the Note #2: with 'ra' or 'rc', use the behavior of a or c when a root isn't found.
directory of the current file.
*'g:ctrlp_root_markers'* *'g:ctrlp_root_markers'*
Use this to set your own root markers in addition to the default ones (.git, Use this to set your own root markers in addition to the default ones (.git,
@ -673,7 +674,7 @@ COMMANDS *ctrlp-commands*
*:CtrlPRoot* *:CtrlPRoot*
:CtrlPRoot :CtrlPRoot
This acts like |:CtrlP| with |g:ctrlp_working_path_mode| = 'rc' and ignores This acts like |:CtrlP| with |g:ctrlp_working_path_mode| = 'r' and ignores
the variable's current value. the variable's current value.
*:CtrlPClearCache* *:CtrlPClearCache*

View File

@ -33,7 +33,7 @@ com! -bar ResetCtrlP cal ctrlp#reset()
com! -bar CtrlPCurWD cal ctrlp#init(0, { 'mode': '' }) com! -bar CtrlPCurWD cal ctrlp#init(0, { 'mode': '' })
com! -bar CtrlPCurFile cal ctrlp#init(0, { 'mode': 'c' }) com! -bar CtrlPCurFile cal ctrlp#init(0, { 'mode': 'c' })
com! -bar CtrlPRoot cal ctrlp#init(0, { 'mode': 'rc' }) com! -bar CtrlPRoot cal ctrlp#init(0, { 'mode': 'r' })
if g:ctrlp_map != '' && !hasmapto(':<c-u>'.g:ctrlp_cmd.'<cr>', 'n') if g:ctrlp_map != '' && !hasmapto(':<c-u>'.g:ctrlp_cmd.'<cr>', 'n')
exe 'nn <silent>' g:ctrlp_map ':<c-u>'.g:ctrlp_cmd.'<cr>' exe 'nn <silent>' g:ctrlp_map ':<c-u>'.g:ctrlp_cmd.'<cr>'
@ -64,3 +64,5 @@ com! -bar CtrlPBookmarkDir cal ctrlp#init(ctrlp#bookmarkdir#id())
com! -n=? -com=dir CtrlPBookmarkDirAdd com! -n=? -com=dir CtrlPBookmarkDirAdd
\ cal ctrlp#call('ctrlp#bookmarkdir#add', <q-args>) \ cal ctrlp#call('ctrlp#bookmarkdir#add', <q-args>)
" vim:ts=2:sw=2:sts=2

View File

@ -47,13 +47,13 @@ Use `:diffthis` when opening multiple files to run `:diffthis` on the first 4 fi
* When invoked, unless a starting directory is specified, CtrlP will set its local working directory according to this variable: * When invoked, unless a starting directory is specified, CtrlP will set its local working directory according to this variable:
```vim ```vim
let g:ctrlp_working_path_mode = 'rc' let g:ctrlp_working_path_mode = 'ra'
``` ```
`'c'` - the directory of the current file. `'c'` - the directory of the current file.
`'r'` - the nearest ancestor that contains one of these directories or files: `'r'` - the nearest ancestor that contains one of these directories or files: `.git` `.hg` `.svn` `.bzr` `_darcs`
`.git` `.hg` `.svn` `.bzr` `_darcs` `'a'` - like c, but only if the current working directory outside of CtrlP is not a direct ancestor of the directory of the current file.
`0` or `''` (empty string) - don't manage working directory. `0` or `''` (empty string) - disable this feature.
Define additional root markers with the `g:ctrlp_root_markers` option. Define additional root markers with the `g:ctrlp_root_markers` option.