vim-ctrlp-switcher icon indicating copy to clipboard operation
vim-ctrlp-switcher copied to clipboard

ctrlp-switch based on CWD

Open huaihuaiVV opened this issue 11 years ago • 6 comments

could this be changed to search based on current file's dir ? not based on pwd , so that i don't need switch to current edit file's dir to use ctrlp-switcher

huaihuaiVV avatar May 05 '14 09:05 huaihuaiVV

It is possible.

Would you like it to search only that folder, or the subdirs as well?

ivan-cukic avatar May 06 '14 17:05 ivan-cukic

yes, in most case, i think you should do like this :
first search the .git / .hg folder , to locate the repository root dir , if not found , should search from the current edit file's dir include its subdirs , this will be more smart .

how do you think ?

huaihuaiVV avatar May 07 '14 03:05 huaihuaiVV

If you want to search from the project's sources, I advise you to set the g:ctrlpswitcher_project_sources for your project. It will override the current directory.

I can add an option to use the project root (it is provided by ctrlp), but still the variable above should be the preferred way to specify the root location under which the search is to be performed.

Now, regarding searching from the current directory - do you want the other results to be hidden, or you'd be fine just with sorting those from the file's dir (and subdirs) first and then the others (this is something I have planned to do)

ivan-cukic avatar May 07 '14 08:05 ivan-cukic

mm.. seems use project root is more smart , setting g:ctrlpswitcher_project_sources to a fix value is not enough , i have several projects , so i need set it every time ..

searching from the current file's directory sometimes is more useful , for example , sometimes my CWD=~/ , if search from ~/ , this will consume lots of time to search ..

could you provide another command just like ctrlp :

: CtrlPSwitcherCurFile
: CtrlPSwitcherCurDir

this will be useful for use ..

Thanks

huaihuaiVV avatar May 07 '14 09:05 huaihuaiVV

That is why the documentation recommends using MarcWeber/vim-addon-local-vimrc.git

could you provide another command just like ctrlp :

Not a fan of adding too many commands. I'd rather have per-project options.

Will think about it.

ivan-cukic avatar May 07 '14 10:05 ivan-cukic

I'd also appreciate if we could search in the result of :pwd, e.g with :CtrlPSwitcherPwd Many thanks!

martong avatar Dec 08 '14 15:12 martong