Wrap with indent

104 views
Skip to first unread message

Keith Edmunds

unread,
Dec 23, 2019, 11:21:38 AM12/23/19
to vim_use
Hi, this is for normal text editing rather than programming. I would like the first line of a paragraph to begin in column 1, and all auto-wrapped lines in that para after line 1 to have an indent of eight spaces:


This is a sample (and narrow) paragraph to
        illustrate the effect I am trying to
        achieve
.

What settings should I be looking at to achieve this?

Csaba Hoch

unread,
Jan 13, 2020, 6:51:35 AM1/13/20
to vim_use
Hi Keith,

You can use the 'indentexpr' option to set a custom indentation function, which will be called each time Vim wraps your line and calculates the new indentation. That function can check whether the newly wrapped line is the first line of the paragraph and return 0 or 8 depending on that. 'formatoptions' is also useful to determine when Vim will wrap your line.

Regards,
Csaba
Reply all
Reply to author
Forward
0 new messages