Search code examples
vimctags

viml: get list of all ctags


Is there a way to get a viml list of all the tags defined in the tags files?

Right now I'm doing this:

let alltags = split(system('cut -f1 tags | tail +7 | uniq'), "\n")

which works for me (i.e. only one tags file, generated by exuberant ctags) but feels very brittle. Is there a way to ask vim for this list instead? For example, if I wanted to get a list of all the files that vim remembers, I could use v:oldfiles instead of digging through the .viminfo file directly. Is there something similar for tags?


Solution

  • Use taglist() to query the tag files. See :h taglist( for mor information.