Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Change working_path_mode option's default value

  • Loading branch information...
commit 4557b5e542133be4257f8ba46d1f572d9b026726 1 parent 309d29d
@kien authored
View
5 autoload/ctrlp.vim
@@ -83,7 +83,7 @@ let [s:pref, s:opts, s:new_opts] = ['g:ctrlp_', {
\ 'use_caching': ['s:caching', 1],
\ 'use_migemo': ['s:migemo', 0],
\ 'user_command': ['s:usrcmd', ''],
- \ 'working_path_mode': ['s:pathmode', 'rc'],
+ \ 'working_path_mode': ['s:pathmode', 'ra'],
\ }, {
\ 'open_multiple_files': 's:opmul',
\ 'regexp': 's:regexp',
@@ -827,7 +827,8 @@ fu! s:SetWD(args)
cal ctrlp#setdir(a:args['dir']) | 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
cal ctrlp#setdir(s:crfpath)
en
View
9 doc/ctrlp.txt
@@ -163,18 +163,19 @@ Where to put the new tab page when opening one: >
*'g:ctrlp_working_path_mode'*
When starting up, CtrlP sets its local working directory according to this
variable: >
- let g:ctrlp_working_path_mode = 'rc'
+ let g:ctrlp_working_path_mode = 'ra'
<
c - the directory of the current file.
r - the nearest ancestor that contains one of these directories or files:
.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.
Note #1: you can use b:ctrlp_working_path_mode (a |b:var|) to set this option
on a per buffer basis.
-Note #2: with both 'r' and 'c' in the option, when a root isn't found, use the
-directory of the current file.
+Note #2: with 'ra' or 'rc', use the behavior of a or c when a root isn't found.
*'g:ctrlp_root_markers'*
Use this to set your own root markers in addition to the default ones (.git,
@@ -673,7 +674,7 @@ COMMANDS *ctrlp-commands*
*: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.
*:CtrlPClearCache*
View
4 plugin/ctrlp.vim
@@ -33,7 +33,7 @@ com! -bar ResetCtrlP cal ctrlp#reset()
com! -bar CtrlPCurWD cal ctrlp#init(0, { 'mode': '' })
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')
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
\ cal ctrlp#call('ctrlp#bookmarkdir#add', <q-args>)
+
+" vim:ts=2:sw=2:sts=2
View
8 readme.md
@@ -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:
```vim
- let g:ctrlp_working_path_mode = 'rc'
+ let g:ctrlp_working_path_mode = 'ra'
```
`'c'` - the directory of the current file.
- `'r'` - the nearest ancestor that contains one of these directories or files:
- `.git` `.hg` `.svn` `.bzr` `_darcs`
- `0` or `''` (empty string) - don't manage working directory.
+ `'r'` - the nearest ancestor that contains one of these directories or files: `.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) - disable this feature.
Define additional root markers with the `g:ctrlp_root_markers` option.
Please sign in to comment.
Something went wrong with that request. Please try again.