Basically, I'd like to have long entries for bulleted / numbered lists that automatically indent like so:

1. Congress shall make no law respecting an establishment of 
   religion, or prohibiting the free exercise thereof; or 
   abridging the freedom of speech, or of the press; or the 
   right of the people peaceably to assemble, and to petition 
   the government for a redress of grievances.

I'm aware that formatoptions=n will do this for numbered lists and formatoptions=c will do this for asterisks (provided they are defined as comment leaders with comments=fb:*), but this only works by forcing an automatic hard wrap. I'd prefer to avoid this situation, since in order to edit the paragraph, I then have to manually Join the lines back into one, make the edits, and then gqq to reformat.

The breakindent setting gets me halfway there, with automatic indentation for softwrapped paragraphs, but it only provides indentation identical to the first line. Is there any setting that combines breakindent's softwrap support with formatoptions+=cn's numbered- and bulleted-list recognition?

  • 2
    Afaik, this is not possible (compare also :h 'breakindentopt'). I think you have to create a feature request either on the vim_dev mailing list or on the issue tracker on github. – Hotschke Apr 26 '17 at 12:06
  • For anyone who stumbles on this question in the future: The GitHub feature request is here; if you're a C programmer, we'd sure appreciate your help in building this feature, and if you're just a mere mortal, maybe you can at least chime in and state your support for it? :) – Ryan Lue Apr 19 '19 at 7:00

As of Vim 8.2.0139, there are no configuration options to specify this behaviour. Furthermore, any changes to the behaviour of Vim's soft wrapping via 'wrap' will require implementing in the source code: there is no workaround possible by using Vimscript.*

See the feature request that Ryan Lue (who asked this question) added to the Vim project's issue tracker after brief discussion in the comments.

As of January 21st 2020, this issue remains open.

* Except, I guess, an extremely hacky and difficult-to-implement-properly one which worked by actually using hard-wrapping and converting to soft-wrapping on save.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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