I'm assuming you are using the default vim python indentation file. That's where this behavior is set, and it's pretty easy to remove. My default indentation file is located at /usr/local/share/vim/vim74/indent/python.vim. Yours might be somewhere else, but you can search for it with this command (assuming you are on a unix environment)
find / -name "python.vim" -type f
The indentation file will be in some directory probably called indent.
Anyways, relevant part of the file looks like this.
" When inside parenthesis: If at the first line below the parenthesis add
" two 'shiftwidth', otherwise same as previous line.
" i = (a
" + b
" + c)
" NOTE: extra lines omitted for brevity
return indent(plnum) + (exists("g:pyindent_nested_paren") ? eval(g:pyindent_nested_paren) : shiftwidth())
endif
return indent(plnum) + (exists("g:pyindent_open_paren") ? eval(g:pyindent_open_paren) : (shiftwidth() * 2))
We will change the last line (or preferably, comment it out!) to remove the *2.
return indent(plnum) + (exists("g:pyindent_open_paren") ? eval(g:pyindent_open_paren) : (shiftwidth()))
If you don't want to mess with default files (which you probably shouldn't), you should copy the file and put it in ~/.vim/indent/python.vim
, and make your changes the the file in there. It will override the default file.
:h indent.txt
, I'm not a hundred percent sure but:h 'cindent'
and:h cinoptions-values
could be helpful.