打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
介绍个cscope插件, 项目任意子目录下开vim也能自动加载...
                           翻遍了google上关于cscope的介绍, 也没找到这个设置技巧, 都是要求在项目根目录生成, 项目根目录打开vim...我懒啊....

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

autoload_cscope.vim

http://www.vim.org/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窗口...绑定和手动都是这样...
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
定义cscope快捷键
Linux应用程序开发(二) ── vim+ctags+cscope
【转】Android源码浏览利器 vim cscope ctags taglist上海软件...
[转]cscope用法启蒙 - Linux系统编程 - york's Blog
vim 安装配置中的坑和技巧
Vi 经典插件 ctags(转)
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服