Reputation: 83
I use taglist() to get a tag list. Then I did some filter, just leave some useful one like this:
let tttlist = taglist("^List$")
"echo ttt
let newtttlist = []
for item in tttlist
if item['kind'] == 'i' || item['kind'] == 'c'
call add(newtttlist, item)
endif
endfor
echo newtttlist
But how to show them like :tag and :ptag in vim?
Upvotes: 1
Views: 382
Reputation: 53634
I see no way to show tags using one of the commands you mentioned so solution is to use :execute
with :ptag
/:tag
on the first item in the list:
execute 'ptag' fnameescape(get(newtttlist, 0, ''))
. More, you don’t need to process tags list after you have found one of the tags:
let tttlist = taglist("^List$")
for item in tttlist
if item.kind == 'i' || item.kind == 'c'
execute 'ptag' fnameescape(item.name)
endif
endfor
. If you mean something else please post here how you are going to make :ptag
/:tag
show you a list of tags: according to the documentation and observed behavior all they do is jumping to the first match.
Also note: if key of the dictionary contains nothing more then latin letters, digits and underscores then you can access it as dict.key
instead of dict['key']
. When dictionary is used to pass structured data it is almost always true.
Upvotes: 1