[TriLUG] Vim '#' character issues

Brian Weaver cmdrclueless at gmail.com
Thu Feb 2 10:26:04 EST 2006


I need some sage advice from any VIM experts out there. I *once* knew
how to prevent vim from reindenting lines that started with the '#'
character. I've lost that small bit of knowledge and now it's driving
me nuts. Doesn't matter what I'm editing: perl, python, shell, etc. If
I want to start and continue a comment at the current indentation
level in a script, whenever I type the first '#' character vim
magically resets the column to 1.

I cannot seem to find any key mapping that prevents this from
happening. If when I start a new line I first type
'<space>-<backspace>-#' then it stays in the correct column.

I've used vim for years and love it, but this particular annoyance is
very remincent of something M$ would do..... "I don't care what you
want, I know better than you! so I'm going to put the # character in
the first column! PBBBbbbbt!"

Google has been very little help on the matter. Google does great when
you want to search on whole words, but it falls flat on it's face when
you need to search on a something with funny characters like #, @, $,
&, etc...

-Brian



More information about the TriLUG mailing list