Vimjas / vim-python-pep8-indent

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

Support an option to force hanging rather than aligned indent #131

Open ssokolow opened 4 years ago

ssokolow commented 4 years ago

While I haven't tested it enough to be sure it's the right way to accomplish what I want, I just modified the version of vim-python-pep8-indent that I got through vim-polyglot as follows:

        " DISABLED: Indent to match position of opening paren.
        " let res = paren_col
        "
        " Force nothing_after_opening_paren-style indentation to avoid having
        " to wear out my dedent keybind fighting with the indenter in 
        " situations like this:
        "
        "   parser.add_argument('-v', '--verbose', action="count", default=2,
        "       help="Increase the verbosity. Use twice for extra effect.")
        "   parser.add_argument('-q', '--quiet', action="count", default=0,
        "       help="Decrease the verbosity. Use twice for extra effect.")
        let res = base + s:sw()

It'd be really nice if I could just set something like this and get on with my life:

let g:python_pep8_indent_disable_paren_aligned = 1
ssokolow commented 4 years ago

Hmm. After more experimentation, it looks like I'm going to need something a little fancier, because I do use both.

I guess I'll have to investigate whether it's easier to make EnterTab produce an aligned indent in what would normally be a base + s:sw() indent situation or to make EnterBackspace generate a base + s:sw() indent (respecting the extra indent for function parameters) in what would normally be an aligned indent situation.

ranelpadon commented 3 years ago

I would like to have this option as well, since I auto-indent the cursor most of the time:

let g:python_pep8_indent_disable_paren_aligned = 1