kien / ctrlp.vim

Fuzzy file, buffer, mru, tag, etc finder.
kien.github.com/ctrlp.vim
7.26k stars 676 forks source link

How to use `ctrlp_buffer_func` #730

Closed snoblenet closed 7 years ago

snoblenet commented 7 years ago

The following works fine for me:

:call NERDTreeCreator.ToggleTabTree("")
<C-P><CR>
:call NERDTreeCreator.ToggleTabTree("")

I do this to force CTRLP to open the file that I select in a window other than the NERDTree window.

Can I trouble you to explain why the following is not working?

let g:ctrlp_buffer_func = { 'enter': 'NERDTreeCreator.ToggleTabTree("")', 'exit': 'NERDTreeCreator.ToggleTabTree("")' }

This also fails:

let g:ctrlp_buffer_func = { 'enter': 'NERDTreeCreator.ToggleTabTree', 'exit': 'NERDTreeCreator.ToggleTabTree' }

The error message is:

Error detected while processing function <SNR>107_AcceptSelection[27]..ctrlp#acceptfile[17]..<SNR>107_PrtExit[4]..<SNR>107_Close[1]..<SNR>107_buffunc

Many thanks

snoblenet commented 7 years ago

Closing as (a) I notice I accidentally commented on the wrong fork and (b) and found a good solution here: https://vi.stackexchange.com/a/11300/12497