python - Comments (#) go to start of line in the insert mode in Vim -


whenever want add comment indented line in vim, hit shift-o (open new row above current, switch insert mode) , start typing python comment (using #). hash magically moved start of line (no indentation) , have click tab few times.

anyone know how work around it?

i suppose have set smartindent in .vimrc

see :h smartindent

when typing '#' first character in new line, indent line removed, '#' put in first column.  indent restored next line.  if don't want this, use mapping: ":inoremap # x^h#", ^h entered ctrl-v ctrl-h. when using ">>" command, lines starting '#' not shifted right. 

i believe don't need smartindenting while coding python. remove settings or add following .vimrc:

au! filetype python setl nosmartindent 

Comments

Popular posts from this blog

ruby - When to use an ORM (Sequel, Datamapper, AR, etc.) vs. pure SQL for querying -

php - PHPDoc: @return void necessary? -

c++ - Convert big endian to little endian when reading from a binary file -