Is there a command to make a newline without the autoindent? In other words, I want o and O to normally autoindent, but is there another command that will not autoindent for just the duration of that command?

Alternatively (if there isn't a way to that exactly), what's a better workaround than just backspacing a ton after autoindenting many tabs too far.


if some_check():
    self.some_long_function_name(withlots, ofargs
                               # ^ Indents to the caret

Pressing o on the andmaybe=keywordargs line leaves me way more indented than I want to be.

  • You seem to have some special indent settings. For me andmaybe is indented 8 chars (double shiftwidth). When I hit o, the cursor is aligned with self. This even works when I indent andmybe manually to align it with the open paranthesis. BTW: Vim 8.1.1223
    – Ralf
    Commented Apr 30, 2019 at 21:17
  • 1
    It's probably a Python plugin that indents it like this? This indenting style is fairly common in Python. As for the question, what does "without the autoindent" mean for you? That it starts at column 0? Anything other than that would be using some form of autoindent (just a different one that what you get right now). Commented Apr 30, 2019 at 21:21
  • Python indent script was last updated in February.
    – Ralf
    Commented Apr 30, 2019 at 21:23
  • I'm not using anything special for Python.
    – Stephen C
    Commented Apr 30, 2019 at 21:24
  • 1
    Yes, it is something in your vimrc. You should Debug your vimrc.
    – Ralf
    Commented May 1, 2019 at 18:04

1 Answer 1


I don't think there is an normal mode command to start a new line without indent. You can, however, remove the indent while in insert mode with the keystrokes 0Ctrl-D, and so it's easy to set up new mappings to do so:

nnoremap <leader>o o0<C-D>
nnoremap <leader>O O0<C-D>

Personally, though, I'd install an indent plugin to handle this for you*.

I use vim-python-pep8-indent which handles your example nicely.

Or indeed, just use the Python indent script included in Vim (via the :filetype command) instead of the 'autoindent' setting. This is the one @Ralf describes in the comments.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.