You are not logged in.

#1 2018-05-27 15:09:57

Michail
Member
From: Moscow, Russia
Registered: 2016-06-23
Posts: 34
Website

Guten Tag - a tag management and viewing plugin for Vim

I was looking for a way to avoid cluttering every subfolder of my projects with Easytags-generated tag files - I prefer to have just one tag file per project, but having a global tag file is a no. So I started writing a plugin to control 'tags' option. Then I realized that having a per-project centralized tag files allows me - with some Vimscripting - to have a list of all functions, classes and whatevers in a project. Think Tagbar, but not limited to displaying an outline of a single file.

How to use it: if you're after just 'tags' option control, you pretty much don't need to do anything (well, apart of installing the thing). The defaults will make the tag file reside in the first directory with either 'src' or '.git' subfolders the plugin can find. You can also add other markers (a full list of options is available in the github repo linked below). This integrates nicely with Easytags.

If you do want to have an outline of your project, use ':GutenTagOpenTagWindow'. It is not mapped to anything by default. Inside the tag outline window 'gd' when the cursor is over a tag will open a new window and jump to the tag.

Just a warning: while tag language and kind are not strictly required to be in tag files, it greatly simplifies plugin's life. For instance, filtering away irrelevant tags is only possible if the language and the kind of the tag are known. So please be nice and set your ctags flags accordingly.

The plugin can be found here.

I plan on expanding and improving the plugin - at the very least, folding in outline window, some syntax highlighting and using preview windows are a must. But I, sadly, don't have much free time nowadays, so mid-week updates are not very likely.


> Don't get impatient, you cannot solve problems by coding, you can only solve them by thinking.

Offline

#2 2018-06-02 19:47:12

Michail
Member
From: Moscow, Russia
Registered: 2016-06-23
Posts: 34
Website

Re: Guten Tag - a tag management and viewing plugin for Vim

The Saturday was productive.

I have added folding in the tags window (and an option to control initial fold level).

I have also implemented highlighting in the tags window, but, unfortunately, it can only work in Neovim, since it requires its extended highlighting capabilities. And it's only for C, C++ and Python atm, but that's going to change quite fast.

Whether or not the Sunday is going to be as productive remains to be seen. Most likely I will just document highlighting options, and maybe work on preview windows usage.


> Don't get impatient, you cannot solve problems by coding, you can only solve them by thinking.

Offline

#3 2018-06-03 16:38:32

Michail
Member
From: Moscow, Russia
Registered: 2016-06-23
Posts: 34
Website

Re: Guten Tag - a tag management and viewing plugin for Vim

That was a fun weekend. I've completely overhauled the logic of tag hierarchy building. It's now language-aware, capable of handling arbitrary nesting and generatlly makes more sense than the previous generic version. The downside is that I have to write the rules for each language separately, so only assembly, C, C++, D, Go, Java, Javascript, Lisp, Lua, Perl, Python, R, Ruby and Rust have it at the moment. Coming next week: the other half of the alphabet. And highlighting documentation, one day.


> Don't get impatient, you cannot solve problems by coding, you can only solve them by thinking.

Offline

#4 2018-06-03 18:53:29

Xyne
Administrator/PM
Registered: 2008-08-03
Posts: 6,963
Website

Re: Guten Tag - a tag management and viewing plugin for Vim

I have uploaded a package to the AUR: https://aur.archlinux.org/packages/vim-gutentag-git/

I haven't tested it yet though because I am still new to tags in Vim and it's not immediately obvious how to set it up (e.g. ":GutenTagOpenTagWindow" does nothing at the moment).


My Arch Linux StuffForum EtiquetteCommunity Ethos - Arch is not for everyone

Offline

#5 2018-06-03 19:40:42

Michail
Member
From: Moscow, Russia
Registered: 2016-06-23
Posts: 34
Website

Re: Guten Tag - a tag management and viewing plugin for Vim

Thanks for the package! Yeah, setup guide is definitely in the todo-list.

As to what is going on with ':GutenTag...': quick testing reveals that if the plugin cannot find tags file anywhere (which I missed during prior testing due to having a global fallback tags file), it indeed doesn't even open tags window. Try creating a tags file manually (or use Easytags, it's completely awesome), see if the plugin begins to work.


> Don't get impatient, you cannot solve problems by coding, you can only solve them by thinking.

Offline

#6 2018-06-03 20:00:05

Michail
Member
From: Moscow, Russia
Registered: 2016-06-23
Posts: 34
Website

Re: Guten Tag - a tag management and viewing plugin for Vim

I've added a message if tags file could not be found, silently failing was not the best design decision.


> Don't get impatient, you cannot solve problems by coding, you can only solve them by thinking.

Offline

#7 2018-06-11 16:20:35

Michail
Member
From: Moscow, Russia
Registered: 2016-06-23
Posts: 34
Website

Re: Guten Tag - a tag management and viewing plugin for Vim

A bit late, but highlighting for all major languages (and some minor too) supported by ctags is done. The second part of the alphabet didn't contain much of them. Tomorrow is a holiday in Russia, so if I'm not too distracted by Haskell coding I might start documenting highlighting options, or start working on using a preview window.


> Don't get impatient, you cannot solve problems by coding, you can only solve them by thinking.

Offline

#8 2018-06-11 22:03:06

bulletmark
Member
From: Brisbane, Australia
Registered: 2013-10-22
Posts: 653

Re: Guten Tag - a tag management and viewing plugin for Vim

Michail, I may be missing something but vim searches upwards from the directory of the current file to automatically find the tags file with the ~/vimrc setting:

se tags=./tags;/

See :h file-searching. So I just put a tags file at the root of my project source trees, i.e. where the .git folder is. You can update the tags with a post-commit hook or cron job etc.
As a related aside, I also update cscope database files there and use the autoload_cscope plugin to make vim find them in the same manner.

Last edited by bulletmark (2018-06-11 22:04:01)

Offline

#9 2018-06-12 09:16:32

Michail
Member
From: Moscow, Russia
Registered: 2016-06-23
Posts: 34
Website

Re: Guten Tag - a tag management and viewing plugin for Vim

Yes, Vim does that. However, Easytags does not - it finds './tags;' and dumps the tag file right here in the middle of your project's directory tree.


> Don't get impatient, you cannot solve problems by coding, you can only solve them by thinking.

Offline

Board footer

Powered by FluxBB