From c4a3c3953eb1970786254c1ee366ccc202f1a971 Mon Sep 17 00:00:00 2001 From: Kien N Date: Tue, 3 Apr 2012 18:55:50 +0700 Subject: [PATCH] Command to open ctrlp in the last accessed mode --- autoload/ctrlp.vim | 5 ++++- doc/ctrlp.txt | 8 +++++++- plugin/ctrlp.vim | 2 ++ 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/autoload/ctrlp.vim b/autoload/ctrlp.vim index 9c09758..5785522 100644 --- a/autoload/ctrlp.vim +++ b/autoload/ctrlp.vim @@ -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 diff --git a/doc/ctrlp.txt b/doc/ctrlp.txt index b828f8a..7cc5a2a 100644 --- a/doc/ctrlp.txt +++ b/doc/ctrlp.txt @@ -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 @@ -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~ diff --git a/plugin/ctrlp.vim b/plugin/ctrlp.vim index ed159a9..6c58d9e 100644 --- a/plugin/ctrlp.vim +++ b/plugin/ctrlp.vim @@ -22,6 +22,8 @@ com! -n=? -com=dir CtrlP cal ctrlp#init(0, ) 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()