vim-python-pep8-indent icon indicating copy to clipboard operation
vim-python-pep8-indent copied to clipboard

Indentation when pressing o

Open kuator opened this issue 7 years ago • 7 comments

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

kuator avatar Jan 28 '19 18:01 kuator

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)

blueyed avatar Jan 29 '19 06:01 blueyed

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

kuator avatar Jan 29 '19 10:01 kuator

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 avatar Jan 29 '19 11:01 blueyed

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 avatar Jan 29 '19 11:01 blueyed

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.

blueyed avatar Jan 29 '19 11:01 blueyed

gif

kuator avatar Jan 29 '19 13:01 kuator

Same

kuator avatar Jan 29 '19 13:01 kuator