Vim automatically removes indentation on Python comments [duplicate]
This question already has an answer here: How to configure vim to not put comments at the beginning of lines while editing python files 8 answers I'm using Vim and editing Python scripts. Autoindent works pretty well in general, but when I start a new line and type '#' to type a comment, Vim unindents that line for me. For example, if have def foo(): and I press enter, Vim will indent properly def foo(): pass but, if instead of typing pass , I type # , it unindents automatically def foo(): # comment class Thing(): def __init__(self): pass # comment line gets unindented all the way my .vimrc