Skip to content Skip to sidebar Skip to footer

How To Set Correct Indendation When Using Formatprg=autopep8?

With the following option set: setlocal formatprg=autopep8\ -aa\ - When I select a single line in Visual Mode and press gq, the autopep8 makes its modification to the line but it a

Solution 1:

You need to give --indent-size 0. So my .vimrc has this line:

" Use gq to clean up code
" Indent to 0 because otherwise it pushes selected lines to the given
" indent-size, no matter the current indent level of the line.
au FileType python setlocal formatprg=autopep8\ -aa\ --indent-size\ 0\ -

Post a Comment for "How To Set Correct Indendation When Using Formatprg=autopep8?"