除了Windows上的C / C ++,是否还有其他语言的CScope风格的源浏览器?

时间:2020-03-05 18:54:11  来源:igfitidea点击:

我对可以插入Vim的工具特别感兴趣,这些工具允许使用CScope样式的源浏览(1-2个击键命令来定位函数定义,调用方,全局符号等),用于C / C ++之外的语言,例如Java和C。 (因为Vim和Cscope已经很好地集成了浏览C / C ++的功能)。我对基于IDE的工具不感兴趣,因为我知道Microsoft和其他供应商已经解决了这个问题-我更喜欢使用Vim进行编辑和浏览,但是不知道Cand /或者Java的工具能给我带来相同的好处像CScope一样强大。

这个问题的原始答案包括一个指向CSWrapper应用程序的指针,该应用程序显然修复了一些用户在集成Vim和CScope时遇到的错误。但是,我的Vim / CScope安装正常。我只是想扩展功能,以允许使用Vim编辑其他语言的代码。

解决方案

回答

这可能是我们要寻找的:

http://www.vim.org/scripts/script.php?script_id=1783

我们还可以通过使用各种map来在自己的.vimrc文件中模拟某些CScope功能。

回答

CScope确实适用于Java。

从http://cscope.sourceforge.net/cscope_vim_tutorial.html:

Although Cscope was originally intended only for use with C code, it's
  actually a very flexible tool that works well with languages like C++
  and Java. You can think of it as a generic 'grep' database, with the
  ability to recognize certain additional constructs like function calls
  and variable definitions. By default Cscope only parses C, lex, and
  yacc files (.c, .h, .l, .y) in the current directory (and
  subdirectories, if you pass the -R flag), and there's currently no way
  to change that list of file extensions (yes, we ought to change that).
  So instead you have to make a list of the files that you want to
  parse, and call it 'cscope.files' (you can call it anything you want
  if you invoke 'cscope -i foofile'). An easy (and very flexible) way to
  do this is via the trusty Unix 'find' command:
find . -name '*.java' > cscope.files
Now run 'cscope -b' to rebuild the database (the -b just builds the
  database without launching the Cscope GUI), and you'll be able to
  browse all the symbols in your Java files. Apparently there are folks
  out there using Cscope to browse and edit large volumes of
  documentation files, which shows how flexible Cscope's parser is.