2

I've recently come across the concept of tags in vim. I run ctags on a file and it generates tags for that file.

When I try to access those tags I use the tag command which basically provides a list of tags generated by ctags and it works just as I expect it to.

But there's also another command tags and I'm not sure what exactly does it do. I tried h tags but there wasn't a helpful documentation.

Can someone please point to any use cases of the tags command?

2
  • Does this account belong to the same person as the answerer? If so please let us know to merge them
    – D. Ben Knoble
    Sep 2, 2021 at 11:26
  • 1
    For future reference, the documentation for the :tags command can be found at :h :tags. h tags is for the tags feature. See some more info on disambiguating help topics in this answer.
    – Rich
    Sep 2, 2021 at 16:28

1 Answer 1

0

From :help tag-stack:

On the tag stack is remembered which tags you jumped to, and from where. Tags are only pushed onto the stack when the 'tagstack' option is set.

The output of ":tags" looks like this:

   # TO tag      FROM line  in file/text
   1  1 main         1  harddisk2:text/vim/test
 > 2  2 FuncA       58  i = FuncA(10);
   3  1 FuncC          357  harddisk2:text/vim/src/amiga.c

This list shows the tags that you jumped to and the cursor position before that jump. The older tags are at the top, the newer at the bottom.

3
  • 1
    Does this account belong to the same person as the poster ? If so, please let us know to merge them
    – D. Ben Knoble
    Sep 2, 2021 at 11:25
  • Yes it does. Do I have to merge them or will it be taken care of? Sep 13, 2021 at 14:51
  • we’ll take steps on our end. (Never done this before, so I’m not 100% sure of the process. We’ll let you know though.)
    – D. Ben Knoble
    Sep 13, 2021 at 16:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.