Package: vim-runtime
Version: 2:9.0.1378-1
Severity: normal
X-Debbugs-Cc: matthijsvand...@gmail.com

Dear Maintainer,

I noticed when editing perl code in vim that pressing enter after the
opening brace of a subroutine no longer indents like you'd expect:

// expected:
        sub foo {
                _<-- cursor here

// actual:
        sub foo {
        _<-- cursor here

This worked correctly in debian bullseye (vim 8.2).


The culprit appears to be that syntax/perl.vim has introduced

        syn region perlSubDeclaration ...

which seems to confuse GetPerlIndent() in indent/perl.vim. If I add
tests for this region name the issue appears to be fixed:

@@ -133,6 +133,7 @@ function! GetPerlIndent()
                         \ || synid == "perlHereDoc"
                         \ || synid == "perlBraces"
                         \ || synid == "perlStatementIndirObj"
+                        \ || synid == "perlSubDeclaration"
                         \ || synid =~ "^perlFiledescStatement"
                         \ || synid =~ '^perl\(Sub\|Block\|Package\)Fold'
                 let brace = strpart(line, bracepos, 1)
@@ -151,6 +152,7 @@ function! GetPerlIndent()
                         \ || synid == "perlMatchStartEnd"
                         \ || synid == "perlBraces"
                         \ || synid == "perlStatementIndirObj"
+                        \ || synid == "perlSubDeclaration"
                         \ || synid =~ '^perl\(Sub\|Block\|Package\)Fold'
                 let ind = ind - shiftwidth()
             endif

But beware that I don't really know how this function works or whether
this is a correct fix, it was just a random guess that seemed to produce
the desired result.


The issue can alternatively be fixed by reverting the

        " Functions
        ...various perlSub* match rules...
        syn match perlFunction ...

section of syntax/perl.vim to its previous (vim 8.2) version, except
with perlSignature renamed to perlSubSignature to ensure it gets
highlighted correctly.



-- System Information:
Debian Release: 12.0
  APT prefers testing-security
  APT policy: (500, 'testing-security'), (500, 'testing'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386, armhf

Kernel: Linux 6.0.0-2-amd64 (SMP w/8 CPU threads; PREEMPT)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), 
LANGUAGE=en_US:en
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

vim-runtime depends on no packages.

Versions of packages vim-runtime recommends:
ii  vim-gtk3 [vim]  2:9.0.1378-1

vim-runtime suggests no packages.

-- no debconf information

Reply via email to