Skip to content

Text rewrapping #1782

@ghost

Description

Hi,

I have done quite some searching but didn't really find a solution, so I am posting here. Apologies if what I describe is a solved issue, after all, and I just didn't find it.

When I write LaTeX, I keep my lines limited to 80 characters, and I also like to start each sentence on a separate line. To maintain this structure when something changes, I am making extensive use of automatic rewrapping with gqis. That works fine, but it does not do what I want if the sentence contains an equation or other environment. Specifically, in a situation like

This is a long sentence, exceeding eighty characters and containing an equation environment,                                         
\begin{equation}                                                                     
 x = 1 \,,                                                                           
\end{equation}                                                                       
that should not be rewrapped.

I would like gqis on the first line to produce

This is a long sentence, exceeding eighty characters and containing an equation
environment,                                         
\begin{equation}                                                                     
 x = 1 \,,                                                                           
\end{equation}                                                                       
that should not be rewrapped.

but instead I get

This is a long sentence, exceeding eighty characters and containing an equation                              
environment, \begin{equation} x = 1 \,,                                              
\end{equation} that should not be rewrapped.     

Is there a way I can teach vim to recognize \begin{}...\end{} as sentence boundaries? And if so, could this be made part of vimtex?

Best,
Sebastian

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions