vim自动加载cscope.out
2013-10-28 00:06
393 查看
cscope可以查找代码的引用、定义等,但是当用vim直接打开项目子目录中的一个文件时,cscope.out不能直接加载。在网上搜了一把,autoload_cscope插件可以解决这个问题,但是这个插件只针对c, h文件,打开cpp时好像不能生效(可能是我没找到设置的地方)。在vim官网上搜了一把,找到了解决方法。看来凡事还是要先官网看下啊,省的耽搁时间。
话不多说,直接代码。
打开文件后,F12就可以自动加入cscope.out了。
Reference:
https://vim.wikia.com/wiki/Autoloading_Cscope_Database
话不多说,直接代码。
打开文件后,F12就可以自动加入cscope.out了。
map <F12> :call LoadCscope()<CR> function! LoadCscope() if (g:iswindows==1) if (executable("cscope") && has("cscope")) let UpperPath = findfile("cscope.out", ".;") if (!empty(UpperPath)) let path = strpart(UpperPath, 0, match(UpperPath, "cscope.out$") - 1) if (!empty(path)) let s:CurrentDir = getcwd() let direct = strpart(s:CurrentDir, 0, 2) let s:FullPath = direct . path let s:AFullPath = globpath(s:FullPath, "cscope.out") let s:CscopeAddString = "cs add " . s:AFullPath . " " . s:FullPath execute s:CscopeAddString endif endif endif else let db = findfile("cscope.out", ".;") if (!empty(db)) let path = strpart(db, 0, match(db, "/cscope.out$")) set nocscopeverbose " suppress 'duplicate connection' error exe "cs add " . db . " " . path set cscopeverbose endif endif endfunction
Reference:
https://vim.wikia.com/wiki/Autoloading_Cscope_Database
相关文章推荐
- Vim中自动加载cscope.out
- cscope插件,项目根目录、任意子目录下打开vim自动加载cscope.out
- Vim中自动加载cscope.out
- Vim中自动加载cscope.out(Vim支持cscope)[zz]
- Vim中自动加载cscope.out
- Vim中自动加载cscope.out
- 修改vim使得cscope自动添加cscope.out
- cscope插件, 项目任意子目录下开vim自动加载.
- vim+taglist+ctags+cscope+自动补齐
- Windows下的VIM - 如何自动在后台更新cscope数据库文件
- vim自动加载Tlist 插件
- vim自动加载模板的插件~
- vim中session自动保存及加载
- vim cscope ctags, 动态创建ctags, cscope.out,
- VIM 自动加载Tags脚本
- vim自动加载模板的插件~
- vim ctags cscope lookupfile插件(包括如何自动生成索引tag、自动查找索引tag)
- vim + ctags + taglist配置和使用 【及】 一键安装 ctags和cscope的方法 【及】vim语法高亮,自动缩进,python 自动缩进设置
- vim + ctags + taglist配置和使用 【及】 一键安装 ctags和cscope的方法 【及】vim语法高亮,自动缩进,python 自动缩进设置
- vim编辑器环境设定(vim启动时自动加载设定)