How to add a folder to projects (like Sublime Text) in VIM?

advertisements

I just switched from Sublime Text to GVIM (on Windows). I am still debating whether I should continue ST or move completely to VIM. One feature that I desperately need (or miss) are

  1. Ctrl+P to go to any file that I want in my list of folders.
  2. Ctrl+Shift+f to find (and replace) any text in those list of folders.

I had added number of folders using Add Folders to Project feature in Sublime Text 3. It was really helpful. Now, I know that CtrlP plugin for VIM can do similar thing, but I can't figure out how to make it search the folders that I want, and not the root directory of current file.

I played around a bit with setting path in my vimrc file without much success.

Can you please help. If it is a repeated question, please excuse me.

Thanks.


AFAIK, ctrlp plugin only searches within one directory (and its descendants). Use the Unix features: make a directory with links to out-of-project directories you are interested in. This way, the association with out-of-project directories is not just something the editor knows about, but something recorded in the actual project.

Search and replace is a bit stickier thing. You want to work with all the files you are interested in, then repeat the replace command through all of them. For example, if you want to do the search for foo and replace with bar on all C files here and under,

:args **/*.c
:argdo %s/foo/bar/g