python - About vim use, when insert comment character(eg. #) -


system: ubuntu 14.04.2

i use vim7.4 write python code, want insert '#' (comment), vim takes '#' top of line. maybe don't explain clearly. example: code:

if 'test' == 'abc':     print 'something' 

i want insert '#' in second line.then happens:

if 'test' == 'abc': #   print 'something' 

this happens automatically.

but want this:

if 'test' == 'abc':     # print 'something' 

there issue indenting of hash character #: http://vim.wikia.com/wiki/restoring_indent_after_typing_hash

q: why vim place # @ first column?

a: using 'smartindent', or have 0# in 'cinkeys' or 'indentkeys' options.

under circumstances, when type '#' character while in insert mode, indent on current line removed. also, formatting or otherwise attempting adjust indent of line starting '#' may not work expect.

this tip discusses issues , how problems can avoided.