[TriLUG] Vim '#' character issues

Shane O'Donnell shaneodonnell at gmail.com
Thu Feb 2 10:37:52 EST 2006


You're likely running into "cindent" or "smartindent"...

http://www.vim.org/htmldoc/indent.html

Set in your .vimrc or at the ":" prompt per session.

And then take a moment to enjoy the fact you aren't using emacs...

Shane O.

On 2/2/06, Brian Weaver <cmdrclueless at gmail.com> wrote:
> 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
> --
> TriLUG mailing list        : http://www.trilug.org/mailman/listinfo/trilug
> TriLUG Organizational FAQ  : http://trilug.org/faq/
> TriLUG Member Services FAQ : http://members.trilug.org/services_faq/
>


--
Shane O.
========
Shane O'Donnell
shaneodonnell at gmail.com
====================



More information about the TriLUG mailing list