Command to open ctrlp in the last accessed mode

This commit is contained in:
Kien N 2012-04-03 18:55:50 +07:00
parent 7cda4083de
commit c4a3c3953e
3 changed files with 13 additions and 2 deletions

View File

@ -1347,6 +1347,7 @@ fu! s:setupblank()
endf
fu! s:leavepre()
if exists('s:itemtype') | let g:CTRLP_LAST_MODE = s:itemtype | en
if s:clrex && !( has('clientserver') && len(split(serverlist(), "\n")) > 1 )
cal ctrlp#clra()
en
@ -1612,7 +1613,9 @@ fu! ctrlp#init(type, ...)
if has('syntax') && exists('g:syntax_on')
cal ctrlp#syntax()
en
cal ctrlp#setlines(a:type)
let type = a:type < 0 ? exists('s:itemtype') ? s:itemtype
\ : exists('g:CTRLP_LAST_MODE') ? g:CTRLP_LAST_MODE : 0 : a:type
cal ctrlp#setlines(type)
cal s:BuildPrompt(1)
endf
" - Autocmds {{{1

View File

@ -477,6 +477,11 @@ COMMANDS *ctrlp-commands*
:CtrlPMRU
Open CtrlP in find Most-Recently-Used file mode.
*:CtrlPLastMode*
:CtrlPLastMode
Open CtrlP in the last mode used.
Works cross-session if you have a ! in your |'viminfo'| option.
*:CtrlPClearCache*
:CtrlPClearCache
Flush the cache for the current working directory. The same as pressing <F5>
@ -904,7 +909,8 @@ Special thanks:~
===============================================================================
CHANGELOG *ctrlp-changelog*
+ New command: |:CtrlPMixed|, search in both files and MRU files.
+ New commands: |:CtrlPLastMode|, open CtrlP in the last mode used.
|:CtrlPMixed|, search in both files and MRU files.
Before 2012/03/31~

View File

@ -22,6 +22,8 @@ com! -n=? -com=dir CtrlP cal ctrlp#init(0, <q-args>)
com! CtrlPBuffer cal ctrlp#init(1)
com! CtrlPMRUFiles cal ctrlp#init(2)
com! CtrlPLastMode cal ctrlp#init(-1)
com! CtrlPClearCache cal ctrlp#clr()
com! CtrlPClearAllCaches cal ctrlp#clra()
com! CtrlPReload cal ctrlp#reset()