Vimjas / vim-python-pep8-indent

A nicer Python indentation style for vim.
Creative Commons Zero v1.0 Universal
790 stars 69 forks source link

Indentation when pressing o #121

Open kuator opened 5 years ago

kuator commented 5 years ago

gif Sorry in advance, I am noob. When I press o with cursor being on super() as you can see on gif, it indents new line. But when I'm outside the method it keeps indenting it

blueyed commented 5 years ago

What do you expect instead?

Should it behave different (i.e. indent by 4 to the "def") when there are two newlines in front already? (like with "return" in the last list of the method)

kuator commented 5 years ago

I guess, it would be better if when I press o while being on super() it indentds new line. But if I go to the beginning of this new created line and press o it doesn't indent it. another

blueyed commented 5 years ago

Makes sense.

I think we can check &autoindent and keep the indent then.

Started working on it in https://github.com/Vimjas/vim-python-pep8-indent/pull/122.

blueyed commented 5 years ago

Can you check the branch/patch from #122 (blueyed:autoindent-0), please? (basically https://github.com/Vimjas/vim-python-pep8-indent/pull/122/commits/106a9186f4baa6e72970e6b62f9b8ce0fb7c1d31)

blueyed commented 5 years ago

Not that trivial.. it fails for using cc on line 3 with:

def a():
    b

    c

The indent should be 4 here IMHO, but cc will keep the existing indent (0), which then gets kept when we return -1.

I am also not sure about assuming that e.g. two previous blank lines should keep the indent from autoindent etc.

kuator commented 5 years ago

gif

kuator commented 5 years ago

Same