Reputation: 8587
I have already read this:
Vim automatically removes indentation on Python comments
I have tried everything that is mentioned there without success:
smartindent
offfiletype indent on
:inoremap # X^H#
None of the above helps: Whenever i start a indented line with a #
the indentation is removed and the cursor is moved to column 0.
Here's the output of :set
: https://gist.github.com/mikehaertl/5387743
And here's the vimrc.local
that i use on Ubuntu 12.10: https://gist.github.com/mikehaertl/1612035
So i'm clueless what else i could try. I don't want my cursor to be moved to column 0 whenever i type an indented #
. Any suggestions?
UPDATE
So i found out this is caused by cindent
. Still this is very obscure to me: Why does vim do that and how can i prevent that from happening if i still want to use cindent
?
Upvotes: 2
Views: 325
Reputation: 59287
If you are using cindent
, it probably contains the 0#
part which comes by
default. You just have to remove it, for example by using an auto command to
be triggered when the file type changes to the type(s) you want with this
indentation disabled.
Is it PHP? If so, adding this line to your .vimrc may help:
autocmd FileType php set cinkeys-=0#
Upvotes: 2
Reputation: 196516
The 'formatoptions'
option governs that behavior. What is the output of :set fo
?
croql
is a good value, see :h fo-table
.
Upvotes: 0