vim - Fold up to the fold start, instead of the indent start -


i use foldmethod=indent , when fold code this:

def cake():     #cake!     print( "cake" )     print( "for" )     print( "you" ) 

i see

def cake():     #cake!     print( "cake" ) +++ 3 lines folded 

but want see

def cake(): +++ 5 lines folded 

is there way fold first line (def cake():) this?

chapters 48 , 49 of learn vimscript hard way talk how that, using foldmethod=expr instead of indent. need make custom ftplugin , put folding script in it; script contains functions used determine fold level different lines should have.

as luck have it, example code given in 2 chapters potion language which, python, whitespace-sensitive, should pretty easy adapt python. since vim comes python ftplugin, think can put folding script described on site .vim/after/ftplugin/python instead of .vim/ftplugin/potion.


Comments