After typing the bracket and enter, the next line will has 8 spaces indentation:
print conn.generate_url(
seconds,
'GET',
instead of 4:
print conn.generate_url(
seconds,
'GET',
My ~/.vimrc
: https://github.com/quantonganh/salt-states/blob/master/vim/vimrc.jinja2
Did I miss something?
Here's the list of my plugins:
├── ctrlp.vim
├── gundo.vim
├── jedi-vim
├── nerdtree
├── powerline
├── salt-vim
├── supertab
├── syntastic
├── ultisnips
├── vim-fugitive
├── vim-indent-guides
├── vim-surround
├── vim-yankstack
└── vundle
Hi,
I guess you need to use \
at the end of line
print conn.generate_url( \
Did you also set smartindent
in .vimrc
?
@tndoan : No, Python does not require a backslash at the end of line.
And I also don't have smartindent
in .vimrc
.
@quantonganh ok. I see.
I think we should add this line in your .vimrc
set autoindent
because you already have filetype plugin indent on
@tndoan : it didn't help.
I'm wondering that: is it follow PEP8 or not?
print conn.generate_url(
seconds,
'GET',
bucket,
key,
response_headers={
'response-content-type': 'application/octet-stream'
})
Continuation lines should align wrapped elements either vertically
using Python's implicit line joining inside parentheses, brackets and
braces, or using a hanging indent. When using a hanging indent the
following considerations should be applied; there should be no
arguments on the first line and further indentation should be used to
clearly distinguish itself as a continuation line.
In a function, we will have something to distinguish with continuous lines, but here's just a print
, should it be 4 or 8 spaces?
Ah, looks like this is optional: extra indentation is not necessary in this case. But jedi-vim
decide to add two indents level instead of one. So, I'm going to close this.
Just BTW: jedi-vim
doesn't do anything with Python's indentation in VIM. This is purely a VIM related setting.
btw: I recommend https://github.com/hynek/vim-python-pep8-indent.
Most helpful comment
btw: I recommend https://github.com/hynek/vim-python-pep8-indent.