Portál AbcLinuxu, 20. prosince 2025 20:57
function jmenoFunkce(parametry)
{
// kod
}
Tj. aby foldoval { az }, ale pokud dam foldmarker={,}, tak to folduje i v jednom řádku, ale já potřebuji, aby před { byl nový řádek. Zkoušel jsem vše a nic se mi nedaří.
Díky za odpověď.
co třeba tohle?
27.1. How do I extend the Vim folding support?
You can use the 'foldexpr' option to fold using an user specified function.
For example, to fold subroutines of the following form into a single line:
sub foo {
my $barf;
$barf = 3;
return $barf;
}
You can use the following commands:
set foldmethod=expr
set foldexpr=MyFoldExpr(v:lnum)
fun! MyFoldExpr(line)
let str = getline(a:line)
if str =~ '^sub\>'
return '1'
elseif str =~ '^}'
return '<1'
else
return foldlevel(a:line - 1)
endif
endfun
For more information, read
:help 'foldexpr'
:help fold-expr
Tiskni
Sdílej:
ISSN 1214-1267, (c) 1999-2007 Stickfish s.r.o.