Я полагаю, у вас есть set smartindent
в вашем .vimrc
См. :h smartindent
When typing '#' as the first character in a new line, the indent for
that line is removed, the '#' is put in the first column. The indent
is restored for the next line. If you don't want this, use this
mapping: ":inoremap # X^H#", where ^H is entered with CTRL-V CTRL-H.
When using the ">>" command, lines starting with '#' are not shifted
right.
Полагаю, вам не нужно умное отступление при кодировании на python. Так что просто удалите его из ваших настроек или добавьте следующее .vimrc:
au! FileType python setl nosmartindent