Wrap with indent

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Wrap with indent

Keith Edmunds
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?

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/d870e39c-b0b3-4d3a-85ad-3517a0ce2966%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: Wrap with indent

Csaba Hoch
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


On Monday, December 23, 2019 at 5:21:38 PM UTC+1, Keith Edmunds wrote:
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?

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/6ea772c4-7561-4f0d-9dce-4cda0016893f%40googlegroups.com.