Putting all ctags matches into quickfix

300 views
Skip to first unread message

Pavel Shevaev

unread,
Dec 22, 2008, 2:28:20 AM12/22/08
to vim...@googlegroups.com
Folks, is it possible to list all ctags matches in a quickfix window?

There are :ts, :sts commands but they are interactive and don't store
the search result anywhere which is IMHO inconvenient at times. Of
course, there are also :tn, :tp but for many similar matches using
them becomes tiresome pretty quickly. I think getting the full list of
all matches in this case in a quickfix could be very handy.

It's quite interesting that cscope and Global plugins provide this
functionality out-of-the-box. I believe this is also possible for
ctags, since "vim can do that, just hack it" ;)

Thanks in advance

--
Best regards, Pavel

Ben Schmidt

unread,
Dec 22, 2008, 2:52:40 AM12/22/08
to vim...@googlegroups.com
> Folks, is it possible to list all ctags matches in a quickfix window?

Nearly. You can do it with a location list, not the quickfix list.

:help :ltag

Basically the quickfix commands all start with :c and are global; the
location list commands all start with :l and are local to a window
(well, 'connected' to a certain window anyway). So you have :lnext,
:lprev, :lopen, etc.

> There are :ts, :sts commands but they are interactive and don't store
> the search result anywhere which is IMHO inconvenient at times.

Though if you reissue :ts without an argument, it will display the same
list you last saw, I believe.

Ben.

Pavel Shevaev

unread,
Dec 22, 2008, 3:15:17 AM12/22/08
to vim...@googlegroups.com
On Mon, Dec 22, 2008 at 10:52 AM, Ben Schmidt
<mail_ben...@yahoo.com.au> wrote:
>
>> Folks, is it possible to list all ctags matches in a quickfix window?
>
> Nearly. You can do it with a location list, not the quickfix list.
>
> :help :ltag

Thanks a lot, how could I've missed it ? :)


--
Best regards, Pavel

Marc Weber

unread,
Dec 22, 2008, 8:17:16 AM12/22/08
to vim...@googlegroups.com
Hi Pavel,

I'd like to tell you that I've written a small tool which can show multi
column lists and filter them afterwards. When writing it I had in mind
replacing the quickfix window in the long run.

For tags this could be usefule because you can filter matches to only
show classes or functions or such..

Maybe this could be what you're looking for as well?
You would have to write some additional code to jump to the tag code
conetents though.

You can find the code in my github tovl repository.

Let me know if you're interested and ping me on irc so that I can help
you getting started

Sincerly

Marc Weber

fritzophrenic

unread,
Dec 22, 2008, 10:41:20 AM12/22/08
to vim_use


On Dec 22, 7:17 am, Marc Weber <marco-owe...@gmx.de> wrote:
> Hi Pavel,
>
> I'd like to tell you that I've written a small tool which can show multi
> column lists and filter them afterwards. When writing it I had in mind
> replacing the quickfix window in the long run.
>

That sounds intriguing...but I like the quickfix window! I wonder if
it would be possible to make the quickfix window modifiable, instead?
Then you could "filter" by using normal Vim commands, like g/\(warning
\|error\)/d for example. If you try this now (setting the 'ma' option
manually) the line numbers being jumped to get all messed up.

Marc Weber

unread,
Dec 22, 2008, 11:29:12 AM12/22/08
to vim...@googlegroups.com
On Mon, Dec 22, 2008 at 07:41:20AM -0800, fritzophrenic wrote:
> On Dec 22, 7:17 am, Marc Weber <marco-owe...@gmx.de> wrote:
> > Hi Pavel,
> >
> > I'd like to tell you that I've written a small tool which can show multi
> > column lists and filter them afterwards. When writing it I had in mind
> > replacing the quickfix window in the long run.
> >
>
> That sounds intriguing...but I like the quickfix window! I wonder if
you can already do that. see tovl. (-> various.vim)
But after having filtered it you can't go back. There is no "undo"
That's why I've been looking for a replacement.
The quickfix window is also bad because you can't preserve indentation..
Eg the list view has been designed so that you can flip order
msg | file | line
Sometime in the past I had need for that..

Using this list view you can add multiple white or black filter..
Then you can :RemoveAllFilters and start from the very beginnning
without rerunning grep or whatever..

The quickfix window is also bad becuase you only have a quickfix and a
location list window. That's it. What if you want to keep two results?
Sure you can use colder.. But this kind of try and error selection is
consuming time. I'd like to have: show a list of grep results and select
one. But that's not a high priority for me now.

I'd be happy if you feel like joining tovl even if there are some flaws.

Sincerly

Marc Weber

Ben Schmidt

unread,
Dec 22, 2008, 5:22:07 PM12/22/08
to vim...@googlegroups.com
> That sounds intriguing...but I like the quickfix window! I wonder if
> it would be possible to make the quickfix window modifiable, instead?
> Then you could "filter" by using normal Vim commands, like g/\(warning
> \|error\)/d for example. If you try this now (setting the 'ma' option
> manually) the line numbers being jumped to get all messed up.

You can modify the quicklist programmatically using Vimscript. See the
getqflist() and setqflist() functions (and getloclist() and
setloclist()). Though not the same as using regular Vim commands, you
could write yourself user commands to do common useful tasks with the
quickfix list, such as filtering out warnings, removing the line the
cursor is on (e.g. once you believe you've fixed it!), etc.. It could
also be handy being able to temporarily add your own; it'd be like marks
but with descriptions!

Ben.

John Beckett

unread,
Dec 22, 2008, 5:38:10 PM12/22/08
to vim...@googlegroups.com
fritzophrenic wrote:
> I wonder if it would be possible to make the quickfix
> window modifiable, instead?
> Then you could "filter" by using normal Vim commands, like
> g/\(warning \|error\)/d for example.

Looking into that has been on my todo list for quite a long time... I
would like to be able to delete lines I'm no longer interested in
(ideally, with undo, but I'll forgo that if necessary).

John

Tony Mechelynck

unread,
Dec 22, 2008, 11:19:34 PM12/22/08
to vim...@googlegroups.com
On 22/12/08 17:29, Marc Weber wrote:
[...]

> The quickfix window is also bad becuase you only have a quickfix and a
> location list window. That's it. What if you want to keep two results?

Split the window and build an additional location list.

> Sure you can use colder.. But this kind of try and error selection is
> consuming time. I'd like to have: show a list of grep results and select
> one. But that's not a high priority for me now.
>
> I'd be happy if you feel like joining tovl even if there are some flaws.
>
> Sincerly
>
> Marc Weber

Best regards,
Tony.
--
Don't you feel more like you do now than you did when you came in?

Reply all
Reply to author
Forward
0 new messages