Friday, June 1, 2012

Re: How to show custom taglist in window like :tag or :ptag

> Please ignore the "echo newtttlist
> I just use it for testing.
> This function's is used filter the tags.
> I search tags with name "List", and only left 'c, i'.
> For example:
> There are 10 tags, after my function filter, there are only 3 left.

I understand so far.

> Then I want to now how to show then like :tag,

Now you've lost me again. :tag is for jumping to tags, not showing them.

> The original ':tag XXX' show tags in a seperate window and ask user to select one and jump to it.

That's not at all what :tag does. Here's the help text:

:[count]ta[g][!] {ident}
Jump to the definition of {ident}, using the
information in the tags file(s). Put {ident} in the
tag stack. See |tag-!| for [!].
{ident} can be a regexp pattern, see |tag-regexp|.
When there are several matching tags for {ident}, jump
to the [count] one. When [count] is omitted the
first one is jumped to. See |tag-matchlist| for
jumping to other matching tags.

Even :tselect, which DOES show a list, only prints the list to the screen and
prompts you for input, it does NOT show the list in a separate window.

I suspect you want behavior like :tselect. If :tag does the same thing for you
as :tselect, then you probably have the 'cscopetag' option set, so that :tag and
CTRL-] act like :tjump, which in turn acts like :tselect if there are multiple
matches. But I'm just guessing here.

If you do want behavior like :tselect, you can loop over your filtered tag list
and use an "echo" command to show whatever you want to the user. Then you can
use the input() function to allow the user to select an entry.

If you actually want to open a scratch buffer, you can do that too. There are
many ways to get text into the buffer, you'll just need to figure out how to
allow the user to select a tag from the buffer. Probably you'll want to set
buftype=nofile and apply a buffer-local mapping or something.

--
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

No comments: