/**********************************************************************
* Vim cscope
* 说明:
* 之前使用Vim进行代码跟踪,都是通过Vim+ctags,传言中是cscope会相对
* 更强大,更有效,所以抽点空学习一下。
*
* 2016-4-10 深圳 南山平山村 曾剑锋
*********************************************************************/ 一、参考资料:
. Editor Tips
http://elinux.org/Editor_Tips
. 在Vim中使用cscope
http://www.cnblogs.com/sunj/archive/2012/03/12/2391610.html
. The Vim/Cscope tutorial
http://cscope.sourceforge.net/cscope_vim_tutorial.html
. vi/vim使用进阶: 程序员的利器 – cscope
http://easwy.com/blog/archives/advanced-vim-skills-cscope/ 二、安装cscope
sudo apt-get install cscope 三、创建Linux kernel cscope ARM库
make ARCH=arm cscope 四、现象:
zengjf@zengjf:~/kernel$ make ARCH=arm cscope
GEN cscope
zengjf@zengjf:~/kernel$ ls cscope.*
cscope.files cscope.out cscope.out.in cscope.out.po
zengjf@zengjf:~/kernel$ 五、.vimrc配置
......
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" cscope setting
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
if has("cscope")
set csprg=/usr/bin/cscope
set csto=
set cst
set nocsverb
" add any database in current directory
if filereadable("/home/zengjf/kernel/cscope.out")
cs add /home/zengjf/kernel/cscope.out
endif
set csverb
set cscopetag
endif nmap <c-@>s :cs find s <C-R>=expand("<cword>")<CR><CR>
nmap <c-@>g :cs find g <C-R>=expand("<cword>")<CR><CR>
nmap <c-@>c :cs find c <C-R>=expand("<cword>")<CR><CR>
nmap <c-@>t :cs find t <C-R>=expand("<cword>")<CR><CR>
nmap <c-@>e :cs find e <C-R>=expand("<cword>")<CR><CR>
nmap <c-@>f :cs find f <C-R>=expand("<cfile>")<CR><CR>
nmap <c-@>i :cs find i ^<C-R>=expand("<cfile>")<CR>$<CR>
nmap <c-@>d :cs find d <C-R>=expand("<cword>")<CR><CR>