Skip to content

Commit f0458d7

Browse files
committed
Add ToggleMRURelative
Closes #398
1 parent 0102255 commit f0458d7

3 files changed

Lines changed: 12 additions & 0 deletions

File tree

autoload/ctrlp.vim

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -937,6 +937,11 @@ fu! s:ToggleKeyLoop()
937937
en
938938
endf
939939

940+
fu! s:ToggleMRURelative()
941+
cal ctrlp#mrufiles#tgrel()
942+
cal s:PrtClearCache()
943+
endf
944+
940945
fu! s:PrtSwitcher()
941946
let [s:force, s:matches] = [1, 1]
942947
cal s:BuildPrompt(1)

autoload/ctrlp/mrufiles.vim

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,10 @@ fu! ctrlp#mrufiles#bufs()
126126
retu s:mrbs
127127
endf
128128

129+
fu! ctrlp#mrufiles#tgrel()
130+
let {s:re} = !{s:re}
131+
endf
132+
129133
fu! ctrlp#mrufiles#cachefile()
130134
if !exists('s:cadir') || !exists('s:cafile')
131135
let s:cadir = ctrlp#utils#cachedir().ctrlp#utils#lash().'mru'

doc/ctrlp.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -572,6 +572,9 @@ Example: >
572572
Set this to 1 to show only MRU files in the current working directory: >
573573
let g:ctrlp_mruf_relative = 0
574574
<
575+
Note: you can use a custom mapping to toggle this option inside the prompt: >
576+
let g:ctrlp_prompt_mappings = { 'ToggleMRURelative()': ['<F2>'] }
577+
<
575578

576579
*'g:ctrlp_mruf_default_order'*
577580
Set this to 1 to disable sorting when searching in MRU mode: >

0 commit comments

Comments
 (0)