Please see line 20 and 21:

enter image description here

My question is about how vim decides to auto-indent line 21, and how to adjust that behaviour.

When I took this screenshot I had formatoptions=qrn1a set, however I believe even without a set, if I format using ggqG or gqip, for example, the same thing happens.

I have many options set, pertaining to text formatting, and it's not clear to me which is doing that and why.

  • 1
    Often it is useful to narrow them down by disabling them all and systematically re-enabling. Could depend on the filetype of the buffer as well.
    – D. Ben Knoble
    Dec 7, 2019 at 3:31
  • 2
    Also: Please don't post images of text
    – D. Ben Knoble
    Dec 7, 2019 at 3:31
  • @D.BenKnoble The only point in that article that stands out to me is the accessibility issue, and fair enough. In this case a graphical representation of what was happening was helpful and relevant. In any case, is there a standard (text) format that represents hidden characters such as spaces? If I were to represent that picture in ASCII, how would you suggest doing it, exactly? I doubt for example that screen-reading software reads out 'space space space space space space'.
    – Harv
    Dec 11, 2019 at 23:17
  • if you need more than just accessibility, you should read this, which I did link to in the article. Standard? Probably not, though I would love to configure reading software to do that—anyone who codes with such software probably has to. You could always just pick a character and say "blah represents space"...
    – D. Ben Knoble
    Dec 11, 2019 at 23:31
  • I had read that, and most of it doesn't apply to the image I posted. I didn't post code, the image is clear, the file size minimal, nobody would need to copy/paste it, etc. As I said, the only really compelling reason I could find was accessibility, and I suppose in case anyone uses this site with images disabled. I'm not trying to be difficult, I just take issue with any claim that what I did was inappropriate or should be discouraged. Contextually I think it made sense.
    – Harv
    Dec 12, 2019 at 0:35

1 Answer 1


I eventually figured out it was cindent.

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.