Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Feature propose for CtrlPMRUFiles #398

Closed
amiorin opened this Issue Apr 22, 2013 · 3 comments

Comments

Projects
None yet
2 participants

amiorin commented Apr 22, 2013

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

Owner

kien commented Jun 10, 2013

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 commented Jun 10, 2013

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.

Owner

kien commented Jun 10, 2013

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 in f0458d7 Jul 5, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment