install vim or gvim
# sudo apt-get install vim-full or gvim
------------------------------
install cscope, ctags
# sudo apt-get install cscope global exuberant-ctags
------------------------------
download plugins
a) taglist.vim: http://www.vim.org/scripts/script.php?script_id=273
b) cppcomplete.vim: http://www.vim.org/scripts/script.php?script_id=527
c) gtags.vim: http://www.vim.org/scripts/script.php?script_id=893
d) cscope_maps.vim http://cscope.sourceforge.net/cscope_maps.vim
e) trinity.vim: (need screxpl.vim, NERD_tree.vim and taglist.vim )
http://www.vim.org/scripts/script.php?script_id=2347
edit .vimrc or _vimrc
nmap
nmap
nmap
nmap
PS: there is a "space between
f) srcexpl.vim: http://www.vim.org/scripts/script.php?script_id=2179
g) NERD_tree.vim: http://www.vim.org/scripts/script.php?script_id=1658
put all plugins into $HOME/.vim/plugin
------------------------------
edit ~/.vimrc
set nu
set enc=utf8
set fenc=utf8
set tabstop=4
set browsedir=last
set nowrap
colorscheme murphy
syntax on
edit ~/.bashrc
set dspmbyte=utf8
------------------------------
write a script for stags and cscope
#!/bin/bash
if [ -n "$1" ]
then
cd $1 sudo find -name "*.h" -o -name "*.c" -o -name "*.cpp" > cscope.file
sudo cscope -bkq -i cscope.file
sudo ctags -Rb
# sudo ctags -R else echo "Please key-in path of project"
fi
PS: vim or gvim should be executed in the source code folder, otherwise cscope may not work
------------------------------
Useage:
ctags ctrl-] : find symbol
ctrl-t : go back to source
cscope
cscope的用法 :
cs find {querytype} {name}
{querytype}
c: find functions calling this function >> speed key:
d: find functions called by this function >> speed key:
e: find this eprep pattern >> speed key:
f: find this file >> speed key:
g: find this definition >> speed key:
i: find file #including this file >> speed key:
s: find this C symbol >> speed key:
t: find assignments to >> speed key:
trinity.vim
cscope -d : using the standalone Cscope browser
cscope -R
ctrl-d
# ctags -R 或是 ctags --recurse
ctags and vim :ta 與 :ts命令
------------------------------
others
http://cscope.sourceforge.net/cscope_vim_tutorial.html
FAQ:
if plugins not work, try this:
mkdir -p ~/.vim/plugin
cp
Reference from:
http://www.wretch.cc/blog/yenho/8773028
No comments:
Post a Comment