Thursday, June 2, 2022

Re: Prevent lines from being unwrapped when the lines end with a certain character/pattern



On Thu, 2 Jun 2022 at 15:55, Christian Brabandt <cblists@256bit.org> wrote:

On Do, 02 Jun 2022, Uday Reddy B wrote:

>
> Just another ping on this question to see if there is a way.
>
> -Uday
>
> On Fri, 20 May 2022 at 07:25, Uday Reddy B <udayreddy@gmail.com> wrote:
>
>     Hello,
>
>     I was trying to find a way to have vim keep lines broken (i.e., not unwrap with auto format) when the lines ended with a certain character. For example, with Latex script, it's desirable to have:
>
>     This is a line. \\
>     Designation \\
>     Affiliation \\
>
>     I have formatoptions set to `tcqan` because I do need auto-formatting everywhere else and in general. However, with such options, vim would auto-format the above to:
>
>     This is a line. \\ Designation \\ Affiliation \\
>
>     My current approach is to switch into and out of `paste` mode when editing such lines to prevent unwrapping but it'd be convenient if this is automatically taken care of with some setting.

I don't think this is currently possible, perhaps try to tune the
'formatlistpat' option so that those lines are detect as "lists"

Thank you for suggesting this - I'll explore it.
 

But I would rather ask, if you see such lines, why do you format them in
first place? This may depend on the document however. Not sure if this
is easily possible

I don't manually/explicitly format them - I have 'a' set in formatoptions. This basically means if I get my cursor in and around those lines while being in the 'insert' mode, those are going to get formatted (unwrapped) and lead to the undesired output.

Thanks,
-Uday

 

Best,
Christian
--
Dass Christus auf eine Hamletische Weise zugrunde ging, und
schlimmer, weil er Menschen um sich berief, die er fallen ließ, da
Hamlet bloß als Individuum perierte.
                -- Goethe, Maximen und Reflektionen, Nr. 1285

--
--
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 vim_use+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/20220602102513.GC4071194%40256bit.org.

--
--
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 vim_use+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/CALA1MBKb0_2CJVdc63cpSaH_8Cqn2WJy6Mmq_7FNk_-LENkjyQ%40mail.gmail.com.

No comments: