-
Notifications
You must be signed in to change notification settings - Fork 399
Text rewrapping #1782
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
See |
Thanks for the answer! Unfortunately, it does not work for me: I used Is there really no way to achieve what I want? I understand you might not want to include this in vimtex, but could you perhaps point me to what exactly I need to modify so that vim will recognize |
I found vim-textobj-latex. That allows me (among other things) to operate on blocks delimited by |
With \documentclass{minimal}
\begin{document}
This is a long sentence, exceeding eighty characters and containing an equation environment below. The equation starts here:
\begin{equation}
x = 1 \,,
\end{equation}
It should not be wrapper. This long sentence should, though. It is also more than eighty characters.
\end{document} Now I do \documentclass{minimal}
\begin{document}
This is a long sentence, exceeding eighty characters and containing an equation
environment below. The equation starts here:
\begin{equation}
x = 1 \,,
\end{equation}
It should not be wrapper. This long sentence should, though. It is also more
than eighty characters.
\end{document} So, I was wrong about |
Interesting. The same settings and sequence for me produce this:
Perhaps there is interference from something else that I have installed... |
I removed all vim-textobj plugins I had installed, but the result is still the same. No idea what else could make it not work -- any suggestions how I might diagnose what is the cause? |
While I would still rather figure out why the solution above does somehow not work for me, I have meanwhile discovered an alternative. Using vim-textobj-sentence, I took inspiration from this unmerged pull request and modified
Of course, globally patching the plugin is unsatisfactory, but I think I can use ftplugin to apply this on the fly for TeX files only. |
Okay, it was a little more complicated, yet, but I finally have a working solution. Leaving this here if anyone ends up here looking wor the same thing in wanted. |
I don't know why it doesn't work, but let's find out. When you're in the relevant LaTeX example file, what does The simplest way for me to help you is for you to make a minimal example. In particular, a minimal vimrc file. In this case, I propose: " test.vim
set nocompatible
let &rtp = '~/.vim/bundle/vimtex,' . &rtp
let &rtp .= ',~/.vim/bundle/vimtex/after'
filetype plugin indent on
syntax enable
set textwidth=80
let g:tex_flavor = 'latex'
let g:vimtex_format_enabled = 1 % test.tex
\documentclass{minimal}
\begin{document}
This is a long sentence, exceeding eighty characters and containing an equation environment below. The equation starts here:
\begin{equation}
x = 1 \,,
\end{equation}
It should not be wrapper. This long sentence should, though. It is also more than eighty characters.
\end{document} With the above, you can do:
The result for me (with both Vim and neovim) is as mentioned in my other post. Btw: I'm mostly ignoring your alternatives, but thanks for investigating and suggesting them - they might be interesting to others! |
In my normal setup (Neovim with a bunch of plugins), it does not say anything.
With standard vim and your setup above, is says
Yes, I understand. I realize those comments are slightly off topic here, not pertaining directly to vimtex, but I left them because I thought others might look here. |
Which means your normal setup is flawed. What is your normal setup? |
Okay, I just found it: In my tests, I always either typed |
Great, happy to hear it! Note:
|
Okay, that does make sense. Well, I am happy, I now have both the local |
Happy to help :) |
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 likeI would like
gqis
on the first line to producebut instead I get
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
The text was updated successfully, but these errors were encountered: