On 01.03.2010 16:29, fka...@googlemail.com wrote:
Have you checked vimoutliner?

http://www.vimoutliner.org/

Very impressive -- it folds/unfolds to a given fold depth, however,
the main aspect I am looking for is not covered by VimOutliner.

I look for a way to fold/unfold ALL folds belonging to the same "type"
of fold (indicated e.g. by a leading keyword before the fold mark), so
see only those folds of interest.

Felix


I think I have the thing you're looking for. I think it's from a vimtip or something:

#v+

"
" Causes all comment folds to be opened and closed using z[ and z]
" respectively.
"
" Causes all block folds to be opened and closed using z{ and z} respectively.
"

function FoldOnlyMatching(re, op)
    mark Z
    keepjumps normal gg
    let s:lastline = -1
    while s:lastline != line('.')
        if match(getline(line('.')), a:re) != -1
            exec 'normal ' . a:op
        endif
        let s:lastline = line('.')
        keepjumps normal zj
    endwhile
    keepjumps normal 'Z
    unlet s:lastline
endfunction

nnoremap <silent> z[ :call FoldOnlyMatching('/[*][*]', 'zo')<CR>
nnoremap <silent> z] :call FoldOnlyMatching('/[*][*]', 'zc')<CR>
nnoremap <silent> z{ :call FoldOnlyMatching('[ \t]*{', 'zo')<CR>
nnoremap <silent> z} :call FoldOnlyMatching('[ \t]*{', 'zc')<CR>

#v-

I've never tried ":call FoldOnlyMatching('Task1{', 'zo')<CR>" or so, but it should work.

cu, Adam.

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

Reply via email to