Hi,

With this kind of syntax:


FUNCTION

NETWORK
foobar
barfo
foo
bar
NETWORK
foobar
barfo
foo
bar

NETWORK
foobar
barfo
foo
bar
END_FUNCTION




I don't happen to foldlevel 1 FUNC END_FUNC and foldlevel 2 NETWORK section.


I just happen to fold all in foldlevel one with this script :

" folding
setlocal foldmethod=expr
setlocal foldexpr=GetFold(v:lnum)

function! GetFold(lnum)
        let currentLine = getline(a:lnum)
        let nextLine    = getline(a:lnum+1)
        if (currentLine =~? '\v^NETWORK') || (currentLine =~? '\v^FUNC')
                return '>1'
        endif
        if (nextLine =~? '\v^NETWORK') || (nextLine =~? '\v^END_FUNC')
                return '<1'
        endif
    return '1'
endfunction

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

--- 
You received this message because you are subscribed to the Google Groups 
"vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to