Make LastMode also be able to restore last working directory
This commit is contained in:
parent
4557b5e542
commit
1fd3760b94
@ -821,11 +821,15 @@ fu! s:PrtSwitcher()
|
||||
endf
|
||||
" - SetWD() {{{1
|
||||
fu! s:SetWD(args)
|
||||
let [s:crfilerel, s:dyncwd] = [fnamemodify(s:crfile, ':.'), getcwd()]
|
||||
let pmode = has_key(a:args, 'mode') ? a:args['mode'] : s:wpmode
|
||||
if has_key(a:args, 'args') && stridx(a:args['args'], '--dir') >= 0
|
||||
\ && exists('s:dyncwd')
|
||||
cal ctrlp#setdir(s:dyncwd) | retu
|
||||
en
|
||||
if has_key(a:args, 'dir') && a:args['dir'] != ''
|
||||
cal ctrlp#setdir(a:args['dir']) | retu
|
||||
en
|
||||
let pmode = has_key(a:args, 'mode') ? a:args['mode'] : s:wpmode
|
||||
let [s:crfilerel, s:dyncwd] = [fnamemodify(s:crfile, ':.'), getcwd()]
|
||||
if s:crfile =~ '^.\+://' | retu | en
|
||||
if pmode =~ 'c' || ( pmode =~ 'a' && stridx(s:crfpath, s:cwd) < 0 )
|
||||
\ || ( !type(pmode) && pmode )
|
||||
|
@ -669,8 +669,9 @@ COMMANDS *ctrlp-commands*
|
||||
Open CtrlP in find Most-Recently-Used file mode.
|
||||
|
||||
*:CtrlPLastMode*
|
||||
:CtrlPLastMode
|
||||
Open CtrlP in the last mode used.
|
||||
:CtrlPLastMode [--dir]
|
||||
Open CtrlP in the last mode used. When having the "--dir" argument, also
|
||||
reuse the last working directory.
|
||||
|
||||
*:CtrlPRoot*
|
||||
:CtrlPRoot
|
||||
|
@ -21,7 +21,7 @@ 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 CtrlPLastMode cal ctrlp#init(-1)
|
||||
com! -n=? CtrlPLastMode cal ctrlp#init(-1, { 'args': <q-args> })
|
||||
|
||||
com! -bar CtrlPClearCache cal ctrlp#clr()
|
||||
com! -bar CtrlPClearAllCaches cal ctrlp#clra()
|
||||
|
Loading…
Reference in New Issue
Block a user