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
