0

Sometimes Vim puts two or more indents where I expect it to be just a single indent. For example when cursor is here (python code):

a = [█

and I press enter, the result is such:

a = [
        █

Whereas i expect it to be here:

a = [
    █

My vimrc at its least:

filetype plugin indent on
set autoindent
set expandtab
set shiftwidth=4
set tabstop=4
set softtabstop=4

How to make vim indent as I expect? I've found nothing useful on the web so I thought it to be more appropriate to ask here.

Drdilyor
  • 477
  • 1
  • 4
  • 14
  • What happens when you get rid of `set autoindent`? Seems like that may indent when you don't want to. – wxz Apr 19 '21 at 17:31
  • I think really, this particular indent makes sense in most languages. To me, it looks like you are starting an array called `a` -- And therefore the first element under `a` should be indented per standard formatting practices. – Zak Apr 19 '21 at 17:34
  • @wxz didn't help, sorry – Drdilyor Apr 19 '21 at 17:35
  • [How do I navigate to topics in Vim's documentation?](https://vi.stackexchange.com/questions/2136/how-do-i-navigate-to-topics-in-vims-documentation) `:h ft-python-indent` – Matt Apr 19 '21 at 17:46
  • @EugeneSh. yeah that works, sorry for a duplicate though – Drdilyor Apr 19 '21 at 17:49
  • didn't delete the question as it may help myself down the road :P – Drdilyor Apr 19 '21 at 18:10

0 Answers0