I'm having some difficulty with the vim reindent files (with
gg=G
).
When I have a larger file (not that large, maybe less than 400 lines of code) I think Vim is having trouble to indent some lines correctly since the line on which the indention of the line afterwards depends is lots of lines above (I assume so, because I tried it with smaller blocks and then the indentation is done correctly).
Example:
\begin{itemize}
\begin{minipage} %indent +2 (after \begin{itemize})
\item %indent +1 (after \begin{minipage}) but -1 because it's \item
%some lines %indent +1
\end{minipage} %indent -1
\end{itemize} %indent -2 <--- here is the Problem, because here has to be -double indent
Now if in this case the lines at %some lines
are lots of lines, then the \end{itemize}
isn't shifted left by two indents (which would be correct) but by only one indent :/
Problem with this is that this messes the whole indention of all lines below.
The solution I'd like most, is if there would be something like the %stopzone
comment for LaTeX to signal the syntax highlighting to stop the current (math)zone.
Maybe something like %indent -1
for move the line by one indent to the left.
Does anyone know how you would implement something like this, or even better, it something like this does already exist?
Or is there some other tool that can do this indentation better than Vim? It would be enough for me to get an approximate indentation from Vim and to use an external terminal utility to make the indentation really correct?
Asked by atticus
(129 rep)
Apr 30, 2020, 09:48 PM
Last activity: May 1, 2020, 04:25 AM
Last activity: May 1, 2020, 04:25 AM