I have tried everything I have found in monks supersearch, and all over the web. The suggestions that held the most promise were found at stackoverflow.com, but to absolutely no avail. I have tried so many different things, and so many combinations of different things in my .vimrc file, and none will work.

This problem has frustrated me for so long, and I'm at my wit's end.

To reproduce my woeful situation, one need only open a perl file in vim and type:

sub foo {

.. then hit the carriage return. That automatically indents your code for you, in most default vim installs. Great! That's what it should do! At this point you can start in with your code, which would look something like:

sub foo { my $bar = 'baz';

All is well. Now hit the carriage return again and start a comment. Instantly vim outdents the comment to column zero:

sub foo { my $bar = 'baz'; # some comment

This is exactly what I am so tired of experiencing. The comment should stay, imo, right in line with "my $bar..." at indented column n (where n=three spaces for me).

*Holds back a long string of curses* Please, anyone, can you tell me what I am missing here, and why vim just will NOT allow me to:

sub foo { my $bar = 'baz'; # some comment

Stuck, and so sad in vim indentation hell, I remain...

--
Tommy

In reply to Can't get vim to stop outdenting Perl comments, any ideas? by Tommy

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.