Wednesday, April 29, 2020

Re: Help: ctags in vim ?

On 2020-04-29, Kunal Chauhan wrote:
> If we talk about gnu global is it far better than cscope.

It's better at most things; worse at some.

It does a better job than cscope at understanding C++ files. Cscope
apparently understands only C; some C++ constructs confuse it.

There was a bug in cscope some years ago that prevented it from
identifying certain forms of function definitions used by some of my
co-workers. I wrote to the maintainer about it. He tried to fix it
but said that the parser became many times larger and didn't think
the fix was worth that.

Cscope has some features that GNU Global lacks, such as finding
functions that are called by the current function.

GNU Global is almost a drop-in replacement for cscope. There is
a gtags.vim plugin that comes with GNU Global. On Ubuntu, it's
/usr/share/doc/global/examples/gtags.vim.gz. There is also
a tutorial at https://www.gnu.org/software/global/globaldoc_toc.html
that explains how to use GNU Global with Vim, either with or without
the plugin. I recommend reading the tutorial.

> If yes how can i install and use it on my ubuntu machine . 

$ sudo apt install global

In your project directory (wherever you normally execute ctags), to
generate the database:

$ gtags

In vim:

:set csprg=gtags-cscope
:cs add GTAGS

Then use it as you would cscope.

Regards,
Gary

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/20200429182718.GC29220%40phoenix.

No comments: