Loading ...
Sorry, an error occurred while loading the content.

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

Expand Messages
  • stevenfrog
    ... 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,
    Message 1 of 4 , Jun 1, 2012
    • 0 Attachment
        Ben Fritz <fritzophrenic@...> May 31 11:01AM -0700  

        On Tuesday, May 29, 2012 9:38:16 PM UTC-5, stevenfrog wrote:
        > endfor
        > echo newtttlist
         
        > But how to show them like :tag and :ptag in vim?
         
        I don't understand what you're trying to achieve.
         
        Assuming your taglist contains tags named "List" your code will echo them to the screen. Which tag do you wish to jump to? If you have the tag name in a variable, like tag_i_want_to_jump_to, you can jump to it with something like:
         
        :exec "tag" tag_i_want_to_jump_to
         
        If you want to do something else, please try to tell us SPECIFICALLY what you are trying to do, what you tried, what you expected to happen, and what happened instead.

         


      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.
      Then I want to now how to show then like :tag,
      The original ':tag XXX' show tags in a seperate window and ask user to select one and jump to it.
      If I filter some of them, it make easier to select one tag from list.
       

      --
      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
    • Ben Fritz
      ... I understand so far. ... Now you ve lost me again. :tag is for jumping to tags, not showing them. ... Jump to the definition of {ident}, using the
      Message 2 of 4 , Jun 1, 2012
      • 0 Attachment
        > 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
      Your message has been successfully submitted and would be delivered to recipients shortly.