Rewrite WD related functions
* Equal priority for default root markers. Closes #241. * Change g:ctrlp_working_path_mode's type.
This commit is contained in:
parent
f14014d0a7
commit
188de26f74
@ -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', 2],
|
\ 'working_path_mode': ['s:pathmode', 'rc'],
|
||||||
\ }, {
|
\ }, {
|
||||||
\ 'open_multiple_files': 's:opmul',
|
\ 'open_multiple_files': 's:opmul',
|
||||||
\ 'regexp': 's:regexp',
|
\ 'regexp': 's:regexp',
|
||||||
@ -354,26 +354,25 @@ fu! s:lsCmd()
|
|||||||
if type(cmd) == 1
|
if type(cmd) == 1
|
||||||
retu cmd
|
retu cmd
|
||||||
elsei type(cmd) == 3 && len(cmd) >= 2 && cmd[:1] != ['', '']
|
elsei type(cmd) == 3 && len(cmd) >= 2 && cmd[:1] != ['', '']
|
||||||
" Find a repo root
|
if s:findroot(s:dyncwd, cmd[0], 0, 1) == []
|
||||||
cal s:findroot(s:dyncwd, cmd[0], 0, 1)
|
|
||||||
if !exists('s:vcsroot')
|
|
||||||
" Try the secondary_command
|
|
||||||
retu len(cmd) == 3 ? cmd[2] : ''
|
retu len(cmd) == 3 ? cmd[2] : ''
|
||||||
en
|
en
|
||||||
unl s:vcsroot
|
|
||||||
let s:vcscmd = s:lash == '\' ? 1 : 0
|
let s:vcscmd = s:lash == '\' ? 1 : 0
|
||||||
retu cmd[1]
|
retu cmd[1]
|
||||||
elsei type(cmd) == 4 && has_key(cmd, 'types')
|
elsei type(cmd) == 4 && has_key(cmd, 'types')
|
||||||
for key in sort(keys(cmd['types']), 's:compval')
|
let [markrs, cmdtypes] = [[], values(cmd['types'])]
|
||||||
cal s:findroot(s:dyncwd, cmd['types'][key][0], 0, 1)
|
for pair in cmdtypes
|
||||||
if exists('s:vcsroot') | brea | en
|
cal add(markrs, pair[0])
|
||||||
endfo
|
endfo
|
||||||
if !exists('s:vcsroot')
|
let fndroot = s:findroot(s:dyncwd, markrs, 0, 1)
|
||||||
|
if fndroot == []
|
||||||
retu has_key(cmd, 'fallback') ? cmd['fallback'] : ''
|
retu has_key(cmd, 'fallback') ? cmd['fallback'] : ''
|
||||||
en
|
en
|
||||||
unl s:vcsroot
|
for pair in cmdtypes
|
||||||
|
if pair[0] == fndroot[0] | brea | en
|
||||||
|
endfo
|
||||||
let s:vcscmd = s:lash == '\' ? 1 : 0
|
let s:vcscmd = s:lash == '\' ? 1 : 0
|
||||||
retu cmd['types'][key][1]
|
retu pair[1]
|
||||||
en
|
en
|
||||||
endf
|
endf
|
||||||
" - Buffers {{{1
|
" - Buffers {{{1
|
||||||
@ -813,30 +812,26 @@ fu! s:PrtSwitcher()
|
|||||||
unl s:force
|
unl s:force
|
||||||
endf
|
endf
|
||||||
" - SetWD() {{{1
|
" - SetWD() {{{1
|
||||||
fu! s:SetWD(...)
|
fu! s:SetWD(args)
|
||||||
let pathmode = s:wpmode
|
|
||||||
let [s:crfilerel, s:dyncwd] = [fnamemodify(s:crfile, ':.'), getcwd()]
|
let [s:crfilerel, s:dyncwd] = [fnamemodify(s:crfile, ':.'), getcwd()]
|
||||||
if a:0 && strlen(a:1) | if type(a:1)
|
let pmode = has_key(a:args, 'mode') ? a:args['mode'] : s:wpmode
|
||||||
cal ctrlp#setdir(a:1) | retu
|
if has_key(a:args, 'dir') && a:args['dir'] != ''
|
||||||
el
|
cal ctrlp#setdir(a:args['dir']) | retu
|
||||||
let pathmode = a:1
|
en
|
||||||
en | en
|
if s:crfile =~ '^.\+://' | retu | en
|
||||||
if a:0 < 2
|
if pmode =~ 'c' || ( !type(pmode) && pmode )
|
||||||
if s:crfile =~ '^.\+://' || !pathmode | retu | en
|
|
||||||
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
|
||||||
if pathmode == 1 | retu | en
|
if pmode =~ 'r' || pmode == 2
|
||||||
let markers = ['.git', '.hg', '.svn', '.bzr', '_darcs']
|
let markers = ['.git', '.hg', '.svn', '.bzr', '_darcs']
|
||||||
|
let spath = pmode =~ 'd' ? s:dyncwd : pmode =~ 'w' ? s:cwd : s:crfpath
|
||||||
if type(s:rmarkers) == 3 && !empty(s:rmarkers)
|
if type(s:rmarkers) == 3 && !empty(s:rmarkers)
|
||||||
cal extend(markers, s:rmarkers, 0)
|
if s:findroot(spath, s:rmarkers, 0, 0) != [] | retu | en
|
||||||
let markers = reverse(filter(reverse(markers), 'count(markers, v:val) == 1'))
|
cal filter(markers, 'index(s:rmarkers, v:val) < 0')
|
||||||
|
en
|
||||||
|
cal s:findroot(spath, markers, 0, 0)
|
||||||
en
|
en
|
||||||
for marker in markers
|
|
||||||
cal s:findroot(s:dyncwd, marker, 0, 0)
|
|
||||||
if exists('s:foundroot') | brea | en
|
|
||||||
endfo
|
|
||||||
unl! s:foundroot
|
|
||||||
endf
|
endf
|
||||||
" * AcceptSelection() {{{1
|
" * AcceptSelection() {{{1
|
||||||
fu! ctrlp#acceptfile(mode, line, ...)
|
fu! ctrlp#acceptfile(mode, line, ...)
|
||||||
@ -883,7 +878,7 @@ fu! s:SpecInputs(str)
|
|||||||
cal s:PrtClear()
|
cal s:PrtClear()
|
||||||
retu 1
|
retu 1
|
||||||
elsei a:str == s:lash && s:spi
|
elsei a:str == s:lash && s:spi
|
||||||
cal s:SetWD(2, 0)
|
cal s:SetWD({ 'mode': 'rd' })
|
||||||
cal ctrlp#setlines()
|
cal ctrlp#setlines()
|
||||||
cal s:PrtClear()
|
cal s:PrtClear()
|
||||||
retu 1
|
retu 1
|
||||||
@ -1223,7 +1218,8 @@ fu! ctrlp#progress(enum, ...)
|
|||||||
\ : '%#CtrlPStats# '.a:enum.' %* '.txt.'%=%<%#CtrlPMode2# %{getcwd()} %*'
|
\ : '%#CtrlPStats# '.a:enum.' %* '.txt.'%=%<%#CtrlPMode2# %{getcwd()} %*'
|
||||||
redraws
|
redraws
|
||||||
endf
|
endf
|
||||||
" Paths {{{2
|
" *** Paths {{{2
|
||||||
|
" Line formatting {{{3
|
||||||
fu! s:formatline(str)
|
fu! s:formatline(str)
|
||||||
let cond = s:ispath && ( s:winw - 4 ) < s:strwidth(a:str)
|
let cond = s:ispath && ( s:winw - 4 ) < s:strwidth(a:str)
|
||||||
retu '> '.( cond ? s:pathshorten(a:str) : a:str )
|
retu '> '.( cond ? s:pathshorten(a:str) : a:str )
|
||||||
@ -1233,7 +1229,7 @@ fu! s:pathshorten(str)
|
|||||||
retu matchstr(a:str, '^.\{9}').'...'
|
retu matchstr(a:str, '^.\{9}').'...'
|
||||||
\ .matchstr(a:str, '.\{'.( s:winw - 16 ).'}$')
|
\ .matchstr(a:str, '.\{'.( s:winw - 16 ).'}$')
|
||||||
endf
|
endf
|
||||||
|
" Directory completion {{{3
|
||||||
fu! s:dircompl(be, sd)
|
fu! s:dircompl(be, sd)
|
||||||
if a:sd == '' | retu [] | en
|
if a:sd == '' | retu [] | en
|
||||||
let [be, sd] = a:be == '' ? [s:dyncwd, a:sd] : [a:be, a:be.s:lash(a:be).a:sd]
|
let [be, sd] = a:be == '' ? [s:dyncwd, a:sd] : [a:be, a:be.s:lash(a:be).a:sd]
|
||||||
@ -1256,7 +1252,7 @@ fu! s:findcommon(items, seed)
|
|||||||
endfo
|
endfo
|
||||||
retu cmn
|
retu cmn
|
||||||
endf
|
endf
|
||||||
|
" Misc {{{3
|
||||||
fu! s:headntail(str)
|
fu! s:headntail(str)
|
||||||
let parts = split(a:str, '[\/]\ze[^\/]\+[\/:]\?$')
|
let parts = split(a:str, '[\/]\ze[^\/]\+[\/:]\?$')
|
||||||
retu len(parts) == 1 ? ['', parts[0]] : len(parts) == 2 ? parts : []
|
retu len(parts) == 1 ? ['', parts[0]] : len(parts) == 2 ? parts : []
|
||||||
@ -1314,7 +1310,7 @@ fu! ctrlp#rmbasedir(items)
|
|||||||
en
|
en
|
||||||
retu a:items
|
retu a:items
|
||||||
endf
|
endf
|
||||||
|
" Working directory {{{3
|
||||||
fu! s:getparent(item)
|
fu! s:getparent(item)
|
||||||
let parent = substitute(a:item, '[\/][^\/]\+[\/:]\?$', '', '')
|
let parent = substitute(a:item, '[\/][^\/]\+[\/:]\?$', '', '')
|
||||||
if parent == '' || parent !~ '[\/]'
|
if parent == '' || parent !~ '[\/]'
|
||||||
@ -1324,20 +1320,34 @@ fu! s:getparent(item)
|
|||||||
endf
|
endf
|
||||||
|
|
||||||
fu! s:findroot(curr, mark, depth, type)
|
fu! s:findroot(curr, mark, depth, type)
|
||||||
let [depth, notfound] = [a:depth + 1, empty(s:glbpath(a:curr, a:mark, 1))]
|
let [depth, fnd] = [a:depth + 1, 0]
|
||||||
if !notfound || depth > s:maxdepth
|
if type(a:mark) == 1
|
||||||
if notfound | cal ctrlp#setdir(s:cwd) | en
|
let fnd = s:glbpath(a:curr, a:mark, 1) != ''
|
||||||
if a:type && depth <= s:maxdepth
|
elsei type(a:mark) == 3
|
||||||
let s:vcsroot = a:curr
|
for markr in a:mark
|
||||||
elsei !a:type && !notfound
|
if s:glbpath(a:curr, markr, 1) != '' | let fnd = 1 | brea | en
|
||||||
cal ctrlp#setdir(a:curr) | let s:foundroot = 1
|
endfo
|
||||||
en
|
en
|
||||||
|
if fnd
|
||||||
|
if !a:type | cal ctrlp#setdir(a:curr) | en
|
||||||
|
retu [exists('markr') ? markr : a:mark, a:curr]
|
||||||
|
elsei depth > s:maxdepth
|
||||||
|
cal ctrlp#setdir(s:cwd)
|
||||||
el
|
el
|
||||||
let parent = s:getparent(a:curr)
|
let parent = s:getparent(a:curr)
|
||||||
if parent != a:curr | cal s:findroot(parent, a:mark, depth, a:type) | en
|
if parent != a:curr
|
||||||
|
retu s:findroot(parent, a:mark, depth, a:type)
|
||||||
en
|
en
|
||||||
|
en
|
||||||
|
retu []
|
||||||
endf
|
endf
|
||||||
|
|
||||||
|
fu! ctrlp#setdir(path, ...)
|
||||||
|
let cmd = a:0 ? a:1 : 'lc!'
|
||||||
|
sil! exe cmd ctrlp#fnesc(a:path)
|
||||||
|
let [s:crfilerel, s:dyncwd] = [fnamemodify(s:crfile, ':.'), getcwd()]
|
||||||
|
endf
|
||||||
|
" Fallbacks {{{3
|
||||||
fu! s:glbpath(...)
|
fu! s:glbpath(...)
|
||||||
let cond = v:version > 702 || ( v:version == 702 && has('patch051') )
|
let cond = v:version > 702 || ( v:version == 702 && has('patch051') )
|
||||||
retu call('globpath', cond ? a:000 : a:000[:1])
|
retu call('globpath', cond ? a:000 : a:000[:1])
|
||||||
@ -1347,12 +1357,6 @@ fu! ctrlp#fnesc(path)
|
|||||||
retu exists('*fnameescape') ? fnameescape(a:path) : escape(a:path, " %#*?|<\"\n")
|
retu exists('*fnameescape') ? fnameescape(a:path) : escape(a:path, " %#*?|<\"\n")
|
||||||
endf
|
endf
|
||||||
|
|
||||||
fu! ctrlp#setdir(path, ...)
|
|
||||||
let cmd = a:0 ? a:1 : 'lc!'
|
|
||||||
sil! exe cmd ctrlp#fnesc(a:path)
|
|
||||||
let [s:crfilerel, s:dyncwd] = [fnamemodify(s:crfile, ':.'), getcwd()]
|
|
||||||
endf
|
|
||||||
|
|
||||||
fu! ctrlp#setlcdir()
|
fu! ctrlp#setlcdir()
|
||||||
if exists('*haslocaldir')
|
if exists('*haslocaldir')
|
||||||
cal ctrlp#setdir(getcwd(), haslocaldir() ? 'lc!' : 'cd!')
|
cal ctrlp#setdir(getcwd(), haslocaldir() ? 'lc!' : 'cd!')
|
||||||
@ -1912,7 +1916,7 @@ fu! ctrlp#init(type, ...)
|
|||||||
let [s:matches, s:init] = [1, 1]
|
let [s:matches, s:init] = [1, 1]
|
||||||
cal ctrlp#reset()
|
cal ctrlp#reset()
|
||||||
noa cal s:Open()
|
noa cal s:Open()
|
||||||
cal s:SetWD(a:0 ? a:1 : '')
|
cal s:SetWD(a:0 ? a:1 : {})
|
||||||
cal s:MapKeys()
|
cal s:MapKeys()
|
||||||
cal ctrlp#syntax()
|
cal ctrlp#syntax()
|
||||||
cal ctrlp#setlines(s:settype(a:type))
|
cal ctrlp#setlines(s:settype(a:type))
|
||||||
|
@ -160,14 +160,18 @@ 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 = 2
|
let g:ctrlp_working_path_mode = 'rc'
|
||||||
<
|
<
|
||||||
1 - the directory of the current file.
|
c - the directory of the current file.
|
||||||
2 - 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
|
||||||
0 - don't manage working directory.
|
{empty-string} - don't manage working directory.
|
||||||
Note: you can use b:ctrlp_working_path_mode (a |b:var|) to set this option on a
|
|
||||||
per buffer basis.
|
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.
|
||||||
|
|
||||||
*'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,
|
||||||
@ -200,7 +204,10 @@ Set the directory to store the cache files: >
|
|||||||
Set this to 0 if you don't want CtrlP to scan for dotfiles and dotdirs: >
|
Set this to 0 if you don't want CtrlP to scan for dotfiles and dotdirs: >
|
||||||
let g:ctrlp_dotfiles = 1
|
let g:ctrlp_dotfiles = 1
|
||||||
<
|
<
|
||||||
You can use |'wildignore'| to exclude anything from the search.
|
|
||||||
|
*'ctrlp-wildignore'*
|
||||||
|
You can use Vim's |'wildignore'| to exclude files and directories from the
|
||||||
|
results.
|
||||||
Examples: >
|
Examples: >
|
||||||
" Excluding version control directories
|
" Excluding version control directories
|
||||||
set wildignore+=*/.git/*,*/.hg/*,*/.svn/* " Linux/MacOSX
|
set wildignore+=*/.git/*,*/.hg/*,*/.svn/* " Linux/MacOSX
|
||||||
@ -226,7 +233,7 @@ Examples: >
|
|||||||
\ 'link': 'SOME_BAD_SYMBOLIC_LINKS',
|
\ 'link': 'SOME_BAD_SYMBOLIC_LINKS',
|
||||||
\ }
|
\ }
|
||||||
<
|
<
|
||||||
Note: ignoring only works when |globpath()| is used to scan for files.
|
Note: ignoring only applies when |globpath()| is used to scan for files.
|
||||||
|
|
||||||
*'g:ctrlp_max_files'*
|
*'g:ctrlp_max_files'*
|
||||||
The maximum number of files to scan, set to 0 for no limit: >
|
The maximum number of files to scan, set to 0 for no limit: >
|
||||||
@ -307,6 +314,7 @@ For the number:
|
|||||||
- If given, it'll be used as the maximum number of windows or tabs to create
|
- If given, it'll be used as the maximum number of windows or tabs to create
|
||||||
when opening the files (the rest will be opened as hidden buffers).
|
when opening the files (the rest will be opened as hidden buffers).
|
||||||
- If not given, <c-o> will open all files, each in a new window or new tab.
|
- If not given, <c-o> will open all files, each in a new window or new tab.
|
||||||
|
|
||||||
For the letters:
|
For the letters:
|
||||||
t - each file in a new tab.
|
t - each file in a new tab.
|
||||||
h - each file in a new horizontal split.
|
h - each file in a new horizontal split.
|
||||||
@ -475,17 +483,19 @@ Structure of the functions: >
|
|||||||
" | + 'h' : user pressed <c-x> (default)
|
" | + 'h' : user pressed <c-x> (default)
|
||||||
" | + 'v' : user pressed <c-v> (default)
|
" | + 'v' : user pressed <c-v> (default)
|
||||||
" | + 't' : user pressed <c-t> (default)
|
" | + 't' : user pressed <c-t> (default)
|
||||||
" | + 'x' : user used the <c-o> dialog (default) and chose
|
" | + 'x' : user used the <c-o> console dialog (default) and
|
||||||
" | "e[x]ternal".
|
" | chose "e[x]ternal".
|
||||||
" |
|
" |
|
||||||
" +- a:line : The selected line.
|
" +- a:line : The selected line.
|
||||||
|
|
||||||
endfunction
|
endfunction
|
||||||
<
|
<
|
||||||
Linux example: open HTML files in the default web browser when <c-t> is pressed
|
Note: does not apply when opening multiple files with <c-z> and <c-o>.
|
||||||
and in Vim otherwise >
|
|
||||||
|
Example: open HTML files in the default web browser when <c-t> is pressed and
|
||||||
|
in Vim otherwise >
|
||||||
function! HTMLOpenFunc(action, line)
|
function! HTMLOpenFunc(action, line)
|
||||||
if a:action == 't' && fnamemodify(a:line, ':e') =~? '^html\?$'
|
if a:action =~ '^[tx]$' && fnamemodify(a:line, ':e') =~? '^html\?$'
|
||||||
|
|
||||||
" Get the filename
|
" Get the filename
|
||||||
let filename = fnameescape(fnamemodify(a:line, ':p'))
|
let filename = fnameescape(fnamemodify(a:line, ':p'))
|
||||||
@ -498,7 +508,7 @@ and in Vim otherwise >
|
|||||||
|
|
||||||
elseif a:action == 'x' && fnamemodify(a:line, ':e') !~? '^html\?$'
|
elseif a:action == 'x' && fnamemodify(a:line, ':e') !~? '^html\?$'
|
||||||
|
|
||||||
" Not a HTML file, simulate pressing <c-o> again
|
" Not a HTML file, simulate pressing <c-o> again and wait for new input
|
||||||
call feedkeys("\<c-o>")
|
call feedkeys("\<c-o>")
|
||||||
|
|
||||||
else
|
else
|
||||||
@ -511,7 +521,6 @@ and in Vim otherwise >
|
|||||||
|
|
||||||
let g:ctrlp_open_func = { 'files': 'HTMLOpenFunc' }
|
let g:ctrlp_open_func = { 'files': 'HTMLOpenFunc' }
|
||||||
<
|
<
|
||||||
Note: this option does not apply when opening multiple files with <c-z>, <c-o>.
|
|
||||||
|
|
||||||
*'g:ctrlp_status_func'*
|
*'g:ctrlp_status_func'*
|
||||||
Use this to customize the statuslines for the CtrlP window: >
|
Use this to customize the statuslines for the CtrlP window: >
|
||||||
@ -630,8 +639,8 @@ COMMANDS *ctrlp-commands*
|
|||||||
|
|
||||||
*:CtrlPRoot*
|
*:CtrlPRoot*
|
||||||
:CtrlPRoot
|
:CtrlPRoot
|
||||||
This acts like |:CtrlP| with |g:ctrlp_working_path_mode| = 2 (ignores the
|
This acts like |:CtrlP| with |g:ctrlp_working_path_mode| = 'rc' and ignores
|
||||||
variable's current value).
|
the variable's current value.
|
||||||
|
|
||||||
*:CtrlPClearCache*
|
*:CtrlPClearCache*
|
||||||
:CtrlPClearCache
|
:CtrlPClearCache
|
||||||
@ -778,7 +787,7 @@ Pasting:~
|
|||||||
Paste the clipboard content into the prompt.
|
Paste the clipboard content into the prompt.
|
||||||
|
|
||||||
<c-\>
|
<c-\>
|
||||||
Open a text dialog to paste <cword>, <cfile>, the content of the search
|
Open a console dialog to paste <cword>, <cfile>, the content of the search
|
||||||
register, the last visual selection, the clipboard or any register into the
|
register, the last visual selection, the clipboard or any register into the
|
||||||
prompt.
|
prompt.
|
||||||
|
|
||||||
@ -790,8 +799,7 @@ When inside the match window (press <s-tab> to switch):~
|
|||||||
a-z
|
a-z
|
||||||
0-9
|
0-9
|
||||||
~^-=;`',.+!@#$%&_(){}[]
|
~^-=;`',.+!@#$%&_(){}[]
|
||||||
Cycle through the lines with the first letter (of paths or filenames) that
|
Cycle through the lines which have the matching first character.
|
||||||
matches that key.
|
|
||||||
|
|
||||||
===============================================================================
|
===============================================================================
|
||||||
INPUT FORMATS *ctrlp-input-formats*
|
INPUT FORMATS *ctrlp-input-formats*
|
||||||
|
@ -17,10 +17,10 @@ let [g:ctrlp_lines, g:ctrlp_allfiles, g:ctrlp_alltags, g:ctrlp_alldirs,
|
|||||||
if !exists('g:ctrlp_map') | let g:ctrlp_map = '<c-p>' | en
|
if !exists('g:ctrlp_map') | let g:ctrlp_map = '<c-p>' | en
|
||||||
if !exists('g:ctrlp_cmd') | let g:ctrlp_cmd = 'CtrlP' | en
|
if !exists('g:ctrlp_cmd') | let g:ctrlp_cmd = 'CtrlP' | en
|
||||||
|
|
||||||
com! -n=? -com=dir CtrlP cal ctrlp#init(0, <q-args>)
|
com! -n=? -com=dir CtrlP cal ctrlp#init(0, { 'dir': <q-args> })
|
||||||
|
com! -n=? -com=dir CtrlPMRUFiles cal ctrlp#init(2, { 'dir': <q-args> })
|
||||||
|
|
||||||
com! -bar CtrlPBuffer cal ctrlp#init(1)
|
com! -bar CtrlPBuffer cal ctrlp#init(1)
|
||||||
com! -bar CtrlPMRUFiles cal ctrlp#init(2)
|
|
||||||
com! -bar CtrlPLastMode cal ctrlp#init(-1)
|
com! -bar CtrlPLastMode cal ctrlp#init(-1)
|
||||||
|
|
||||||
com! -bar CtrlPClearCache cal ctrlp#clr()
|
com! -bar CtrlPClearCache cal ctrlp#clr()
|
||||||
@ -31,9 +31,9 @@ com! -bar ClearCtrlPCache cal ctrlp#clr()
|
|||||||
com! -bar ClearAllCtrlPCaches cal ctrlp#clra()
|
com! -bar ClearAllCtrlPCaches cal ctrlp#clra()
|
||||||
com! -bar ResetCtrlP cal ctrlp#reset()
|
com! -bar ResetCtrlP cal ctrlp#reset()
|
||||||
|
|
||||||
com! -bar CtrlPCurWD cal ctrlp#init(0, 0)
|
com! -bar CtrlPCurWD cal ctrlp#init(0, { 'mode': '' })
|
||||||
com! -bar CtrlPCurFile cal ctrlp#init(0, 1)
|
com! -bar CtrlPCurFile cal ctrlp#init(0, { 'mode': 'c' })
|
||||||
com! -bar CtrlPRoot cal ctrlp#init(0, 2)
|
com! -bar CtrlPRoot cal ctrlp#init(0, { 'mode': 'rc' })
|
||||||
|
|
||||||
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>'
|
||||||
@ -43,18 +43,24 @@ cal ctrlp#mrufiles#init()
|
|||||||
|
|
||||||
com! -bar CtrlPTag cal ctrlp#init(ctrlp#tag#id())
|
com! -bar CtrlPTag cal ctrlp#init(ctrlp#tag#id())
|
||||||
com! -bar CtrlPQuickfix cal ctrlp#init(ctrlp#quickfix#id())
|
com! -bar CtrlPQuickfix cal ctrlp#init(ctrlp#quickfix#id())
|
||||||
|
|
||||||
com! -n=? -com=dir CtrlPDir
|
com! -n=? -com=dir CtrlPDir
|
||||||
\ cal ctrlp#init(ctrlp#dir#id(), <q-args>)
|
\ cal ctrlp#init(ctrlp#dir#id(), { 'dir': <q-args> })
|
||||||
|
|
||||||
com! -n=? -com=buffer CtrlPBufTag
|
com! -n=? -com=buffer CtrlPBufTag
|
||||||
\ cal ctrlp#init(ctrlp#buffertag#cmd(0, <q-args>))
|
\ cal ctrlp#init(ctrlp#buffertag#cmd(0, <q-args>))
|
||||||
|
|
||||||
com! -bar CtrlPBufTagAll cal ctrlp#init(ctrlp#buffertag#cmd(1))
|
com! -bar CtrlPBufTagAll cal ctrlp#init(ctrlp#buffertag#cmd(1))
|
||||||
com! -bar CtrlPRTS cal ctrlp#init(ctrlp#rtscript#id())
|
com! -bar CtrlPRTS cal ctrlp#init(ctrlp#rtscript#id())
|
||||||
com! -bar CtrlPUndo cal ctrlp#init(ctrlp#undo#id())
|
com! -bar CtrlPUndo cal ctrlp#init(ctrlp#undo#id())
|
||||||
com! -bar CtrlPLine cal ctrlp#init(ctrlp#line#id())
|
com! -bar CtrlPLine cal ctrlp#init(ctrlp#line#id())
|
||||||
|
|
||||||
com! -n=? -com=buffer CtrlPChange
|
com! -n=? -com=buffer CtrlPChange
|
||||||
\ cal ctrlp#init(ctrlp#changes#cmd(0, <q-args>))
|
\ cal ctrlp#init(ctrlp#changes#cmd(0, <q-args>))
|
||||||
|
|
||||||
com! -bar CtrlPChangeAll cal ctrlp#init(ctrlp#changes#cmd(1))
|
com! -bar CtrlPChangeAll cal ctrlp#init(ctrlp#changes#cmd(1))
|
||||||
com! -bar CtrlPMixed cal ctrlp#init(ctrlp#mixed#id())
|
com! -bar CtrlPMixed cal ctrlp#init(ctrlp#mixed#id())
|
||||||
com! -bar CtrlPBookmarkDir cal ctrlp#init(ctrlp#bookmarkdir#id())
|
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>)
|
||||||
|
@ -46,12 +46,12 @@ Use `:difft` when opening multiple files to run `:difft` on the first 4 files.
|
|||||||
* 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 = 2
|
let g:ctrlp_working_path_mode = 'rc'
|
||||||
```
|
```
|
||||||
|
|
||||||
0 - don't manage working directory.
|
`{empty-string}` - don't manage working directory.
|
||||||
1 - the directory of the current file.
|
`c` - the directory of the current file.
|
||||||
2 - 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`
|
||||||
|
|
||||||
Define additional root markers with the `g:ctrlp_root_markers` option.
|
Define additional root markers with the `g:ctrlp_root_markers` option.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user