On Mar 18, 2011, at 10:39 AM, Benjamin R. Haskell wrote:
> On Fri, 18 Mar 2011, S Krishnakumar wrote:
>
>> Hello,
>> I recently moved to Vim 7.3 from Vim 7.2. I use Vim primarily for coding
>> Perl. The first thing I noticed today was that the indenting is not what I
>> would expect--
>> Code Snippet
>> -------------
>> Line 1: if( $hello ){
>> Line 2: @add = mysub(\@add, "hello\n");
>> Line 3: print @add,"\n";
>> Line 4: }
>> In Vim 7.2, when I press enter (in INSERT mode) after line 2, I am taken to
>> the proper (indented) location in Line 3. In Vim 7.3, I am taken to the
>> beginning of Line 3.
>> I am able to replicate this behavior with my .vimrc containing just:
>> syntax on
>> filetype plugin indent on
>> Any thoughts?
>
> [Don't double-post. (*he types as he rewards that behavior...*). Or if you
> do, at least keep it in the original thread.]
>
>
> I don't know what versions of the Perl ft-related plugins shipped with Vim
> 7.3, but there's an external repository with more up-to-date versions at:
>
> https://github.com/petdance/vim-perl
>
> Maybe try those.
>
> I've noticed problems after lines containing escaped characters, which also
> tend to look like the unary reference operator on line 2 (the '\' of
> '\@add'), but never noticed them enough to try to fix them. And I've been
> working with Perl far less than I'd prefer lately.
>
> --
> Best,
> Ben
I find that perltidy (http://perltidy.sourceforge.net/) is a great help in
formatting perl code.
With this map:
map <leader>p mz:%!perltidy -q<CR>'z
I don't worry about getting the formatting perfect as I type, as it is easily
cleaned up with this command. Also it is highly recommended that you tweak
your .perltidyrc to your liking.
Matt
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php