Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 881385 - app-editors/vim-core-9.0.* perl filetype indent broken
Summary: app-editors/vim-core-9.0.* perl filetype indent broken
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Vim Maintainers
URL: https://github.com/vim-perl/vim-perl/...
Whiteboard:
Keywords: PATCH
Depends on: 884399
Blocks:
  Show dependency tree
 
Reported: 2022-11-15 10:02 UTC by Evert
Modified: 2022-12-08 09:11 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
vim filetype indent perl patch (indent-perl-20220427.patch,788 bytes, patch)
2022-11-15 10:02 UTC, Evert
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Evert 2022-11-15 10:02:52 UTC
Created attachment 832789 [details, diff]
vim filetype indent perl patch

Please include attached patch to app-editors/vim-core-9.0.*
Since vim-9.0.*, perl code indent is broken when using
  filetype plugin indent on
  syntax enable
in /etc/vim/vimrc.local

$ vim /tmp/hello1.pl
#!/usr/bin/perl
main();
sub main {
print "hello\n";
# hello
}

I found https://github.com/vim-perl/vim-perl/issues/267#issuecomment-803380012
and created/implemented a patch, see attachment.
It simply adds a single (but essential) line for perlFiledescStatement in /usr/share/vim/vim90/indent/perl.vim

After implementing the patch, perl code indent behaves correctly:
$ vim /tmp/hello2.pl
#!/usr/bin/perl
main();
sub main {
    print "hello\n";
    # hello
}

I found multiple URLs stating to use
  filetype plugin indent on
  syntax enable
but in the current state, especially "filetype indent on" only breaks perl indent.
I was able to workaround using cindent/cinkeys etc. however, this patch really fixes it.

Note: since vim-9.0.* my bash indent was broken too but
  filetype plugin indent on
also fixes that issue.
Comment 1 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-11-18 04:11:23 UTC
Thanks for the report. Is the idea that vim-perl is bundled in vim and periodicially vim upstream will pull in a new version?
Comment 2 Evert 2022-11-27 08:41:57 UTC
I guess so.
However, I expect years to pass before the patch makes it into vim upstream.
2021-03-20 patch was suggested
2022-04-27 patch was committed 5bca914 (dev branch vim-perl.git)

Seeing
- the patch took over one year to be committed in dev vim-perl.git
- gentoo uses vim.git
- vim-perl.git master & release-prep branch are dated 2017-09-12
It wouldn't surprise me another couple of years to pass before the patch finally makes it into vim upstream.
So I would appreciate the patch to be included into app-editors/vim-core so all Gentoo users can benefit.

Note:
Since vim-9.0, smartindent is broken (at least for bash & perl).
This triggered me for the research.
Comment 3 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-12-05 04:23:18 UTC
(In reply to Evert from comment #2)
Sure, I wasn't saying no -- just wanted to understand the situation.
Comment 4 Larry the Git Cow gentoo-dev 2022-12-05 04:37:04 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5e288b5eef64b3cb8d6fae135f98b88cb09109f1

commit 5e288b5eef64b3cb8d6fae135f98b88cb09109f1
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2022-12-05 04:35:52 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2022-12-05 04:35:52 +0000

    app-editors/vim: use latest patchset (Perl fix)
    
    Use latest vim-patches for Perl highlighting fix. Should be no functional change as
    it only matters in vim-core.
    
    Closes: https://bugs.gentoo.org/881385
    Signed-off-by: Sam James <sam@gentoo.org>

 app-editors/vim/Manifest            | 1 +
 app-editors/vim/vim-9.0.1000.ebuild | 6 ++++--
 app-editors/vim/vim-9999.ebuild     | 7 ++++---
 3 files changed, 9 insertions(+), 5 deletions(-)

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=76cbe77db7c98d2d1147bd77a1cca25cba627083

commit 76cbe77db7c98d2d1147bd77a1cca25cba627083
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2022-12-05 04:31:31 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2022-12-05 04:31:31 +0000

    app-editors/vim-core: backport Perl highlighting fix
    
    Closes: https://bugs.gentoo.org/881385
    Signed-off-by: Sam James <sam@gentoo.org>

 app-editors/vim-core/Manifest                 | 1 +
 app-editors/vim-core/vim-core-9.0.1000.ebuild | 5 +++--
 app-editors/vim-core/vim-core-9999.ebuild     | 3 ++-
 3 files changed, 6 insertions(+), 3 deletions(-)
Comment 5 Evert 2022-12-08 09:11:18 UTC
Thanks :)