From f0458d7026fd3cfe4f6e8fb787034a342314d418 Mon Sep 17 00:00:00 2001 From: Kien N Date: Mon, 10 Jun 2013 09:51:43 +0700 Subject: [PATCH] Add ToggleMRURelative Closes #398 --- autoload/ctrlp.vim | 5 +++++ autoload/ctrlp/mrufiles.vim | 4 ++++ doc/ctrlp.txt | 3 +++ 3 files changed, 12 insertions(+) diff --git a/autoload/ctrlp.vim b/autoload/ctrlp.vim index aea84d5..632c5f1 100644 --- a/autoload/ctrlp.vim +++ b/autoload/ctrlp.vim @@ -937,6 +937,11 @@ fu! s:ToggleKeyLoop() en endf +fu! s:ToggleMRURelative() + cal ctrlp#mrufiles#tgrel() + cal s:PrtClearCache() +endf + fu! s:PrtSwitcher() let [s:force, s:matches] = [1, 1] cal s:BuildPrompt(1) diff --git a/autoload/ctrlp/mrufiles.vim b/autoload/ctrlp/mrufiles.vim index e34f450..a182111 100644 --- a/autoload/ctrlp/mrufiles.vim +++ b/autoload/ctrlp/mrufiles.vim @@ -126,6 +126,10 @@ fu! ctrlp#mrufiles#bufs() retu s:mrbs endf +fu! ctrlp#mrufiles#tgrel() + let {s:re} = !{s:re} +endf + fu! ctrlp#mrufiles#cachefile() if !exists('s:cadir') || !exists('s:cafile') let s:cadir = ctrlp#utils#cachedir().ctrlp#utils#lash().'mru' diff --git a/doc/ctrlp.txt b/doc/ctrlp.txt index 9921759..3435e82 100644 --- a/doc/ctrlp.txt +++ b/doc/ctrlp.txt @@ -572,6 +572,9 @@ Example: > Set this to 1 to show only MRU files in the current working directory: > let g:ctrlp_mruf_relative = 0 < +Note: you can use a custom mapping to toggle this option inside the prompt: > + let g:ctrlp_prompt_mappings = { 'ToggleMRURelative()': [''] } +< *'g:ctrlp_mruf_default_order'* Set this to 1 to disable sorting when searching in MRU mode: >