Corrections after having used this a bit:
b:did_perl_statusline
makes the variable local to the buffer instead of g: which is global
my $line_number = ($curwin->Cursor)[0]; my $line = ''; $line = $curbuf->Get( $line_number ) while $line_number-- > 0 && $line !~ /^\s*sub\s+(\w+)\b/; my $sub_name = $1 || '(not in sub)'; VIM::DoCommand("let subName='$sub_name'");
I do believe this is faster than getting all lines for each cursor movement :)
]]>
my @document = map { $curbuf->Get($_) } 0 .. $curbuf->Count; my ( $line_number, $column ) = $curwin->Cursor;
could become:
my ( $line_number, $column ) = $curwin->Cursor; $line = $curbuf->Get($line_number--) while $line_number >=0 && !/^\s* sub \s+ (\w+)/x;
.. so you can avoid ->Get-ting all 8k lines when you need "only" 200 ;)
]]>
my @document = map { $curbuf->Get($_) } 0 .. $curbuf->Count; my ( $line_number, $column ) = $curwin->Cursor;
can become:
my ( $line_number, $column ) = $curwin->Cursor; $line = $curbuf->Get($line_number--) while $line_number >=0 && !/^\s* sub \s+ (\w+)/x;
.. so you can avoid ->Get-ting all 8k lines when you need "only" 200 ;)
]]>