Re: how to fold lines not containing a pattern ?

2006-06-06 Thread Christian MICHON

excellent trick! (as usual)

thanks a lot!

On 6/5/06, Tim Chase [EMAIL PROTECTED] wrote:

 and how do I do if I want it to be case insensitive ?
 ie I want to detect Warning WARNING warning

   :help expr-=~?

set foldmethod=expr foldexpr=getline(v:lnum)=~?'warning'?0:1

I also tried another approach of

set foldexpr=(match(getline(v:lnum),'warning\\c')+1)?0:1

which also seems to do the trick.

-tim








--
Christian


Re: how to fold lines not containing a pattern ?

2006-06-05 Thread Tim Chase

I would like to fold all lines not containing a keyword like
'warning'. Basically, I want to be able to open a file,
apply this filter and immediately see all warnings
related in my file.


:set foldmethod=expr
:set foldexpr=getline(v:lnum)=~'warning'?'1':1

You can learn more by reading at

:help fold-expr
:help 'foldmethod'

which explains a bit of what's going on.

-tim






Re: how to fold lines not containing a pattern ?

2006-06-05 Thread Mikolaj Machowski
Dnia poniedziaƂek, 5 czerwca 2006 13:51, Christian MICHON napisaƂ:

 any help/hint appreciated. thanks in advance

Tim already gave folding solution but you may be also interested in:

:vimgrep /warning/ %

m.

ps. Vim7 required.