python - How to set correct indendation when using formatprg=autopep8? -
with following option set: setlocal formatprg=autopep8\ -aa\ -
when select single line in visual mode , press gq
, autopep8 makes modification line alters indentation of line: defaults indent of 4 spaces, no matter current indentation level of line(s). want assume lines indented correctly , leave them alone.
similarly, if set --indent-size 8
switch autopep8
push lines indent level of 8 spaces. note if visual selection large enough encompass top-level indentation (i.e. there's no indentation), indented correctly. tend visual select smaller blocks before making commits.
you need give --indent-size 0
. .vimrc
has line:
" use gq clean code " indent 0 because otherwise pushes selected lines given " indent-size, no matter current indent level of line. au filetype python setlocal formatprg=autopep8\ -aa\ --indent-size\ 0\ -
Comments
Post a Comment