[email protected] (Lech Lorens) - Sun, Apr 14, 2013 at 11:04:33PM +0200
> On 29-Mar-2013 Cody Cutler <[email protected]> wrote:
> > Hello list.  The attached patch allows optional regexs to be passed to
> > :tj and friends.  these regexs is then used to further refine available
> > tags before they are printed.
> > 
> > This patch is useful when you have many tags for a single identifier.
> > For example, suppose a large C++ project has initialize() methods for
> > 100s of classes.  Going through the list of tags printed by :tj is
> > tedious.  Most of the time I know additional information about the
> > identifier I am looking for like the containing object type or source
> > filename.  The text after the '/' in the argument is used as a regex
> > (unless a '/' is the first character of the tag identifier, then the
> > text after the second '/' is used) to match against the "other" tag
> > fields (which often contains the containing type name).  If a '!' is
> > present, text after it is used to match against filenames.  With this
> > patch you can type:
> > 
> > :tj initialize/SomeClass
> > 
> > to list all tags that also contain "SomeClass" in their "other" fields
> > or
> > 
> > :ts initialize/!arch/amd64
> > 
> > to list all tags matching initialize that contain "arch/amd64" in the
> > containing file's pathname.  Or a mix:
> > 
> > :ts initialize/SomeClass!arch/amd64
> > 
> > The '/' and '!' characters were chosen somewhat arbitrarily--I'm not
> > sure if they are a safe choice.
> > 
> > Any comments are appreciated.
> 
> I've been thinking about your proposed patch and I would have one 
> problem with it: it doesn't seem intuitive and although I do work with 
> software projects with quite large amounts of source code, I don't think 
> I would use it much (because I wouldn't be able to remember all the 
> quirks of the command).

I agree that appending a '/' followed by a regex is not a very intuitive
way to specify the info for the search but I don't think it is less
intuitive than the current state since :tj and company already treat '/'
specially if it is the first character of search string (which is why
the paragraph explaining my patch's usage is so long -- I wanted to be
clear that the original functionality was preserved).

There's really not much to remember!  If :tj generates a huge list of
tags, just append a / with a search pattern.  If you haven't tried the
patch yet, you should give it a whirl!

> However, I think that there is a very simple solution to your problem 
> which does not require changing the behaviour of Vim itself: create 
> a command in VimL which will do everything you need. For this command 
> I would use the following:
> - input() ??? for getting the name of the tag to jump to,
> - taglist() ??? to get a list of tags matching what the user chose to 
>   view,
> - input() ??? to get the name of the class,
> - input() ??? to get the file name pattern,
> - match() ??? to filter the tag list returned by taglist() with the 
>   criteria based on the values input by the user,
> - setqflist(), setloclist() ??? to create a list displayed in the quickfix 
>   window (:copen, :lopen),
> - inputlist() ??? perhaps instead of using setqflist() to make the 
>   experience akin to using :tselect.

Cool, thanks for this.  One reason I submitted the patch was to see what
other ways people deal with this situation -- I've had a hard time
finding other solutions.  I would love a solution in base though.

Thanks Lech.

-- 
-- 
You received this message from the "vim_dev" 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

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Raspunde prin e-mail lui