Monday, February 6, 2012

Re: folding quickfix list based on the command which created it

On Mon, Feb 6, 2012 at 2:13 PM, sc <toothpik@swbell.net> wrote:
> On Mon, Feb 06, 2012 at 11:33:42AM -0800, Ben Fritz wrote:
>> I am trying to make a quickfix folding solution for my Vim config,
>> which does something different based on what command created the
>> quickfix list.
>
>> Currently, I'm folding all results from the same file together for the
>> various 'grep' commands, and I'm folding away all but errors and
>> warnings for compiler commands.
>
>> But I'm not happy with my detection of the command which created the
>> quickfix window.
>
>> I've tried using w:quickfix_title, but I have discovered this variable
>> does not get set until sometime after the filetype autocmd fires.
>
> why not create wrapper functions for grep and compile -- the
> grep one can invoke your grep, then source a script to set your
> grep folding rules -- the compile one would invoke the compiler
> and source a compile folding rule module -- with separate
> modules they'd never have to check to see what type of folding
> to do, they'd already know
>

That is an option, I suppose, but I will run into the same difficulty
as with the QuickFixCmdPre/Post autocmd events suggested by Marcin.
Namely, that I would be able to determine the correct folding method
at *creation* of the list, but not when *displaying the list* in the
quickfix window. For example, running :vimgrep, followed by :make,
followed by :colder, would need to remember to use the grep folding.

I could probably wrap ALL the various quickfix functions, and keep a
global or window-local stack which remembers both the list and the
fold method for each saved quickfix or location list (basically
reimplementing :colder and :cnewer and :lolder and :lnewer in
vimscript, with the added folding variable) but I think this is more
effort than it is worth. And, I'd have even more trouble with
plugin-created lists (from setqflist) using this method.

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