Kononenko.ws
Volodymyr Kononenko's Personal Web Site

Vim + cscope + NERD Tree

1. Create needed directories for vim in your home:

mkdir ~/.vim
cd ~/.vim
mkdir bundle


2. Install pathogen for easy installing further vim plugins:

cd ~/.vim
mkdir ~/.vim/autoload
curl -Sso ~/.vim/autoload/pathogen.vim https://raw.github.com/tpope/vim-pathogen/master/autoload/pathogen.vim


3. Install NERD Tree vim plugin:

cd ~/.vim/bundle
git clone https://github.com/scrooloose/nerdtree.git


4. Go to your project dir:

cd /path/to/project/dir


5. Create cscope.files list for further generating cscope database. For example:

find . -name "*.java" -or -name "*.c" -or -name "*.cpp" -or -name "*.h" > cscope.files


6. Generate the Cscope database (full doc):

cscope -b -q


7. Download cscope_maps.vim to the vim plugin directory:

cd ~/.vim/plugin
wget http://cscope.sourceforge.net/cscope_maps.vim


8. Optionally you may add key mapping to the .vimrc file. For example:

nmap <c-f> :cs find g <c-r>=expand("<cword>")<cr><cr>

Now just press Ctrl+F on the function call to see its definition(s).

Note: possibly you will need to run vim in your project dir and execute “ :cs add cscope.out” for adding cscope database.

Setting NERDTree width

To set NERDTree file browser width, just add the following line to teh .vimrc:

let g:NERDTreeWinSize = 60


where 60 is width value. Change it as you like.

Posted: Volodymyr M. Kononenko on 2013-02-26 at 09:20
Modified: 2013-07-26 at 10:41
Tags:

Comments



   __ __  __  __   ___   _____   __  ___
  / //_/ / / / /  / _ \ / ___/  /  |/  /
 / ,<   / /_/ /  / // // (_ /  / /|_/ / 
/_/|_|  \____/  /____/ \___/  /_/  /_/


Page Tools

Development and Design by Volodymyr Kononenko
Powered by DokuWiki