Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Feature propose for CtrlPMRUFiles #398

Closed
amiorin opened this Issue · 3 comments

2 participants

@amiorin

I'm an avid user of CtrlPMRUFiles. I would like to add a new prompt
mapping ToggleRelative to change the value of g:ctrlp_mruf_relative

@kien
Would you accept this pull request?
What shortcut? <C-i>, <C-q> or <C-u>?
CtrlP is awesome. :-)

This is my current workaround to change the variable outside the CtrlP prompt.

let g:ctrlp_mruf_relative = 1
nnoremap <silent> so :exec g:ctrlp_mruf_relative == 0 ? "let g:ctrlp_mruf_relative = 1 \| CtrlPMRUFiles" : "let g:ctrlp_mruf_relative = 0 \| CtrlPMRUFiles"<CR>

By the way I have written a plugin that works very well with CtrlPMRUFiles.
https://github.com/amiorin/vim-project

@kien
Owner

This will create a <c-@> mapping which you can use to toggle mruf_relative while in the prompt:

let g:ctrlp_buffer_func = {
    \ 'enter': 'PrtEnFunc',
    \ }

func! PrtEnFunc()
    nnoremap <buffer> <silent> <c-@> :call ToggleMRURelative()<cr>
endfunc

func! ToggleMRURelative()
    let g:ctrlp_mruf_relative = !g:ctrlp_mruf_relative
    call ctrlp#call('s:Reset', {})
    call ctrlp#call('s:PrtClearCache')
endfunc

I'm still undecided about adding this in, and the most I'll probably add is the ToggleMRURelative function.

@amiorin

Thanks @kien. Also should be available for binding. c-@ requires the shift on my keyboard.
I would prefer s:ToogleMRURelative() and the entry in the manual. I can make the pull request if you wish.

@kien
Owner

I've already made the change, just haven't merged it. Also, that snippet is supposed to go into .vimrc, so you can choose the key and use it in any case.

@kien kien closed this issue from a commit
@kien Add ToggleMRURelative
Closes #398
f0458d7
@kien kien closed this in f0458d7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.