Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Vim CtrlP Plugin: Manually set root search directory?

Tags:

vim

vim-plugin

I have read through the docs but cannot figure out if this is possible.

I want to keep the default setting of g:ctrlp_working_path_mode = 2, but I want the ability to manually override that for all buffers in the current window if I want.

Specifically, I want to issue a ctrlp command or change a ctrlp config variable that sets the root search directory, such that is uses that directory for all future searches, regardless of which buffer I'm in.

Bonus Question: Is it possible to set two root directories, so that it searches both of them and combines the results?

Thanks!

like image 692
Jonah Avatar asked Aug 08 '12 21:08

Jonah


3 Answers

Try this:

let g:ctrlp_working_path_mode = 'ra'

'c' - the directory of the current file.

'r' - the nearest ancestor that contains one of these directories or files: .git .hg .svn .bzr

'a' - like c, but only if the current working directory outside of CtrlP is not a direct ancestor of the directory of the current file.

0 or '' (empty string) - disable this feature.

Source: https://github.com/kien/ctrlp.vim

Also, here: https://github.com/kien/ctrlp.vim/issues/292 , the author has provided one way to set fullpath:

:CtrlP /var/www/myproject/bla/bla/theme
like image 139
Chandresh Pant Avatar answered Nov 20 '22 10:11

Chandresh Pant


I use:

let g:ctrlp_cmd='CtrlP :pwd'

this remap ctrlp commando to :ctrlp :pwd

like image 15
Steven Koch Avatar answered Nov 20 '22 10:11

Steven Koch


You can use the below in your vimrc

noremap <C-a> :CtrlP /yourdir/<CR>

whenever you press ctrl+a the ctrlp will take /yourdir/ as root directory

like image 9
Ram Avatar answered Nov 20 '22 10:11

Ram