Chinaunix首页 | 论坛 | 博客
  • 博客访问: 451478
  • 博文数量: 64
  • 博客积分: 3271
  • 博客等级: 中校
  • 技术积分: 727
  • 用 户 组: 普通用户
  • 注册时间: 2009-07-30 18:42
文章分类

全部博文(64)

文章存档

2013年(1)

2011年(19)

2010年(42)

2009年(2)

分类: LINUX

2011-04-04 15:47:48

By default, Cscope adds cscope.out from Vim's current directory and from $CSCOPE_DB. However, if you start Vim from say ~/proj/src/a/b/c/, while cscope.out is at ~/proj/src/, that cscope.out won't be loaded automatically.

For ctags, there is a nice trick: with the command :set tags=tags;/ Vim will look for tags file everywhere starting from the current directory up to the root.

This tip provides the same "autoloading" functionality for Cscope. Just add the following to your :

  1. function! LoadCscope()
  2. let db = findfile("cscope.out", ".;")
  3. if (!empty(db))
  4. let path = strpart(db, 0, match(db, "/cscope.out$"))
  5. set nocsverbose " suppress 'duplicate connection' error
  6. exe "cs add " . db . " " . path
  7. set csverbose
  8. endif
  9. endfunction
  10. au BufEnter /* call LoadCscope()
阅读(3546) | 评论(0) | 转发(0) |
0

上一篇:perl ,=>,括号

下一篇:nginx+fastcgi

给主人留下些什么吧!~~