分享

介绍个cscope插件, 项目任意子目录下开vim也能自动加载...

 书剑阁2013 2015-05-20
                           翻遍了google上关于cscope的介绍, 也没找到这个设置技巧, 都是要求在项目根目录生成, 项目根目录打开vim...我懒啊....

麻烦, 于是自己憋着想写一个, 写了一半, 试了下去官网搜索, 竟然有!!

autoload_cscope.vim

http://www./scripts/script.php?script_id=157

就像ctags设定set tags=tags; 在项目根目录生成总的tags, 任意子目录下即可自动加载...

用了这个插件, 项目根目录生成cscope.out, 随便钻到哪个项目子目录下, 自动正常加载, 正常搜索...

Tips:

Shell代码
  1. alias更方便  
  2. alias cr='ctags -R --fields=+lS && cscope -Rbq'  
  3. 这个全局变量设置下, 禁止这个插件自带的mapping  
  4. let g:autocscope_menus=0  



config:
Shell代码
  1. """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""  
  2. " Cscope  
  3. """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""  
  4.   
  5. " Use both cscope and ctag  
  6. set cscopetag  
  7.   
  8. " Show msg when cscope db added  
  9. set cscopeverbose  
  10.   
  11. " Use tags for definition search first  
  12. set cscopetagorder=1  
  13.   
  14. " Use quickfix window to show cscope results  
  15. set cscopequickfix=s-,c-,d-,i-,t-,e-  
  16.   
  17. " Cscope mappings  
  18. nnoremap <C-w>\ :scs find c <C-R>=expand("<cword>")<CR><CR>  
  19. nnoremap <C-\>s :cs find s <C-R>=expand("<cword>")<CR><CR>  
  20. nnoremap <C-\>g :cs find g <C-R>=expand("<cword>")<CR><CR>  
  21. nnoremap <C-\>c :cs find c <C-R>=expand("<cword>")<CR><CR>  
  22. nnoremap <C-\>t :cs find t <C-R>=expand("<cword>")<CR><CR>  
  23. nnoremap <C-\>e :cs find e <C-R>=expand("<cword>")<CR><CR>  
  24. nnoremap <C-\>f :cs find f <C-R>=expand("<cfile>")<CR><CR>  
  25. nnoremap <C-\>i :cs find i ^<C-R>=expand("<cfile>")<CR>$<CR>  
  26. nnoremap <C-\>d :cs find d <C-R>=expand("<cword>")<CR><CR>  



problem:
我启用了cscope的quickfix, 但是它的反应和tags不一样, 不是开个quickfix窗口让你选, 而是直接跳到第一个, 虽然你可以自己打开quickfix窗口...绑定和手动都是这样...

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多