On 2008-10-28, Gary Johnson <[EMAIL PROTECTED]> wrote: > On 2008-10-28, David Fishburn <[EMAIL PROTECTED]> wrote: > > > I don't know whether or not you can use folding within the quickfix > > > window to fold all the matches to one fold per file. It seems that > > > it should work. That would be really nice. I'll have to try that. > > > > I would think a .vim/vimfiles/after/ftplugin/qf.vim would allow you to > > setup the following: > > > > setlocal foldlevel=0 > > setlocal foldmethod=expr > > > > " Comparing the filename of the current line and the next line: > > setlocal foldexpr=matchstr(getline(v:lnum), > > '^[^|]\+')=~matchstr(getline(v:lnum+1), '^[^|]\+')'?'<1':1 > > > > > > Should work, but I cannot get the escaping right on the foldexpr line. > > Can anyone take it a step further? > > You need to either not have any spaces on the right-hand side, or > you need to escape them. It also appears that you need to escape > the | and double-escape the +, e.g., > > setlocal > foldexpr=matchstr(getline(v:lnum),'^[^\|]\\+')=~matchstr(getline(v:lnum+1),'^[^\|]\\+')?'<1':1 > > > I think you also had an extraneous single-quote to the left of the > question mark, which I removed above. > > It still doesn't work as desired--it folds the two lines where the > file name changes--but that's as far as I've gotten at the moment.
Just exchanging the '<1' and the 1 at the end seems to fix it: setlocal foldexpr=matchstr(getline(v:lnum),'^[^\|]\\+')=~matchstr(getline(v:lnum+1),'^[^\|]\\+')?1:'<1' Thanks for getting that started. Regards, Gary --~--~---------~--~----~------------~-------~--~----~ You received this message from the "vim_use" maillist. For more information, visit http://www.vim.org/maillist.php -~----------~----~----~----~------~----~------~--~---
