Thursday, May 24, 2012

Re: Cross referencing in VIM

Sorry I bring this up again.
My difficulty is with installing cscope and getting it to run.

Per the documentation, I have added this line into cscope_maps.vim:
 if filereadable("cscope.out")
        cs add cscope.out 
...

and to _vimrc, I added:

if has('cscope')
" set cscopetag cscopeverbose
...

then, every time I attempt to open a file in Vim, I get following error message: 

"Error detected while processing C:\Program Files\Vim\vim73\plugin\cscope_maps.vim:
line   42:
E262: error reading cscope connection 0"

I looked for a solution with no luck.

Anyone knows how to fix this and better yet how to get cscope in Vim running?

Thanks for any help.



From: Ben Fritz <fritzophrenic@gmail.com>
To: vim_use@googlegroups.com
Cc: "vim@vim.org" <vim@vim.org>; hilal Adam <hilaldm@yahoo.com>
Sent: Friday, May 18, 2012 10:48 AM
Subject: Re: Cross referencing in VIM

On Thursday, May 17, 2012 10:39:39 PM UTC-5, hilal Adam wrote:
> I am bias towards VIM when it comes to editors for doing development
> work (mainly C). But I have this problem regarding cross referencing. I
> use ctags which only provides half of the equation when I search for
> definitions of functions and variables. However, I haven't been able to
> find a useful way for doing cross referencing. For example in cases
> where I want find where a function is used, etc. I have come across
> cscope which is outdated and lacks proper documentation for how to
> install and run. Could anyone help with pointing to the right direction.
>
> I appreciate any help in this respect.
>

I used to use CScope a lot. I did not find it hard to use or understand in
the slightest. I found Vim's built-in documentation (:help cscope) to be all
I really needed, plus web searches for scope for setting up the databases in
the first place. With cscope, I also used the CCTree plugin to view an
entire call tree for any given function:

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

I've since mostly stopped using CScope, because I've started using Eclim.
Eclim integrates Vim with Eclipse allowing you to use Eclipse's extensive
code navigation and information features, including:

• search for all references (e.g. function calls) for the item under the
  cursor, similar to :cscope find s
• seacrh for the declaration of an item, similar to :cscope find g
• search for the definition of an item :cscope find g
• show the entire call tree leading to a function, similar to CCTree +
  cscope.
• start a vimgrep relative to the project root, similar to :cscope find t or
  :cscope find e
• fuzzy find of files within the project, similar to :cscope find f

It can do much more (like insert-mode completion) but the above is all I
used cscope for, and Eclim does it better.

  http://eclim.org/features.html

Note that there is not (that I have found) an equivalent to :cscope find d
or :cscope find i, but I used these very rarely, if at all. Nor does Eclim
currently support call trees of functions *called by* the given function,
although Eclipse does, so that may come in the future.

No comments:

Post a Comment