local environment with multiple projects: How to setup cscope vim?

1.3k views Asked by At

A localhost development environment (ubuntu maverick gvim apache -> web php css js)

The vim plugin "project" appears to be a more robust form of NERDTree - using folds, etc.

The vim plugin "sessions" seems geared to reload a project's last working environment condition.

The vim plugin "cscope" seems to allow navigating project files via classes, functions, etc.

I have my vim settings in:

/home/folder/.vim/plugins
/home/folder/.vimrc

My progjects are in:

/home/folder/project_1/website/ 100+ dir/files
/home/folder/project_2/website/ 100+ dir/files  (and so on)

Questions: How best to create the tags for cscope to use per project so that any particular session in gvim finds only those tags specific to a project? Do I need to change the .vimrc each time I want to focus on a particular project or is there a better way?

Thanks in advance!

1

There are 1 answers

0
Ricalsin On BEST ANSWER

I may not have written this question right, it seems a bit terse but the answer to the final question was this:

You don't really create "tags" for cscope (as in ctags, or exhuberant_tags), you actually create a database in the cscope setup. A nice / simple beginners tutorial is here: http://karmicdriver.wordpress.com/2010/12/09/cscope-installtion-in-8steps/

The trick is to create this database at the base of each project (if you are working on multiple projects) so that it loads only files specific to that project. Then, you can use the nice vim plugin called autoload_cscope (http://www.vim.org/scripts/script.php?script_id=157) which is designed to search backup the tree from where you open a file in vim - finding the cscope database (called cscope.out) at the base of the project in which the file you opened belongs - and loading it on startup. Nice.

cscope is essentially ctags on steriods. It does a lot more. Check it out.