indent/perl.vim is double indenting

84 views
Skip to first unread message

James Lance

unread,
Aug 31, 2016, 9:11:15 AM8/31/16
to vim-perl
I'm trying to figure out how to hint the perl indenter to not double indent when multiple opening braces are on the same line.  Eg. If I type the following:

$foo = ({<CR>

I would like to get: ("|" represents my cursor)
$foo = ({
   
|

Instead I get:
$foo = ({
       
|


Additionally after adding a few keys to the hash, and attempting to close it I would like to get:
$foo = ({
    key
=> 'bar',
});

What I'm really getting is:
$foo = ({
        key
=> 'bar';
   
});

It really seems like indent/perl.vim is over indenting when it finds multiple "({[", and under indenting when it files multiple ")}]" on the same line.  I've tried poking at the perl.vim indent file but wasn't able to get it to behave. 

Thanks!

-James

Andy Lester

unread,
Aug 31, 2016, 9:52:14 AM8/31/16
to vim-...@googlegroups.com

> On Aug 31, 2016, at 1:09 AM, James Lance <jal...@thelances.net> wrote:
>
> I'm trying to figure out how to hint the perl indenter to not double indent when multiple opening braces are on the same line.

I don’t know that there’s a way to do it. If nobody else comes up with one in the next day or two, please submit it as a ticket in Github.

--
Andy Lester => www.petdance.com

Rob Hoelz

unread,
Aug 31, 2016, 11:37:00 AM8/31/16
to vim-perl
I have a local change to my vimfiles to fix this issue:

https://github.com/hoelzro/vimfiles/commit/f8bab0eb12441fbd4274984223dd6ee6a8859499

I don't know why I didn't push this upstream.

Andy Lester

unread,
Aug 31, 2016, 11:41:58 AM8/31/16
to vim-...@googlegroups.com

On Aug 31, 2016, at 10:37 AM, Rob Hoelz <rdh...@gmail.com> wrote:


Oh that would be tremendous because it has long annoyed me, too.

James Lance

unread,
Sep 1, 2016, 2:00:59 AM9/1/16
to vim-perl
I took a stab at this myself last night.  I solved it a slightly different way, but I like yours better.

https://github.com/neybar/vim-perl/commit/8ac06b42688efe7d07ebc614e3eef135365c52dd
Reply all
Reply to author
Forward
0 new messages