Before:
for (blah blah blah): blah blah blah
<-- cursor is here
After:
for (blah blah blah): blah blah blah
# <-- the indentation has been dominated
Anyone know how to fix this?
Thanks.
--
View this message in context: http://www.nabble.com/Stupid-unindenting-when-starting-a-comment-with---tf4057169.html#a11525218
Sent from the Vim - General mailing list archive at Nabble.com.
Fuzzy
--
Latin: Dum spiro spero.
English: While I breathe, I hope.
> -----Original Message-----
> From: vim...@googlegroups.com
> [mailto:vim...@googlegroups.com] On Behalf Of skawaii
> Subject: Stupid unindenting when starting a comment with #
>
> I've run into this every time I work on some Ruby and Python
> code and it's
> really starting to irritate me. When I'm indented and start a
> comment with
> #, the line becomes completely unindented. To illustrate:
>
> Before:
> for (blah blah blah): blah blah blah
> <-- cursor is here
>
> After:
> for (blah blah blah): blah blah blah
> # <-- the indentation has been dominated
>
> Anyone know how to fix this?
>
> Thanks.
In your .vimrc, make sure you have "filetype indent on". You probably
don't need "set smartindent".
I think that's what fixed it for me.
Mike
Thanks!
Have you checked Fuzzy's answer? To be clearer, I am pasting from the
help file about smartindent:
When typing '#' as the first character in a new line, the indent for
that line is removed, the '#' is put in the first column. The
indent is restored for the next line. If you don't want this, use
this mapping: ":inoremap # X^H#", where ^H is entered with CTRL-V
CTRL-H.
Also be sure to bottom-post, as I am doing.
Best regards,
Yongwei
--
Wu Yongwei
URL: http://wyw.dcweb.cn/