The ftplugin vimtex provides the file indent/tex.vim
with following line
setlocal indentkeys+=[,(,{,),},],\&,=item,=else,=fi
'indentkeys'
'indk'
string (default"0{,0},:,0#,!^F,o,O,e"
)
local to buffer
A list of keys that, when typed in Insert mode, cause reindenting of the current line. Only happens if'indentexpr'
isn't empty. The format is identical to'cinkeys'
, see |indentkeys-format|.
Consider this list environment:
\begin{itemize}
\item <CURSOR>
\end{itemize}
When you enter a newline and then a second \item
,
at first the cursor will be indented to the second level (sw=2
)
\begin{itemize}
\item
<CURSOR>
\end{itemize}
then when you enter manually \item
, the line will be reindented and you get the desired indentation
\begin{itemize}
\item
\item <CURSOR>
\end{itemize}
However, if you do the same by using the UltiSnips snippet it
(from honza/vim-snippets)
snippet it "Individual item" b
\item $0
endsnippet
you end up with an unintended second level indentation of the second \item
:
\begin{itemize}
\item
\item <CURSOR>
\end{itemize}
Does anyone know how to resolve this?
This has already been raised on the issue tracker of UltiSnips, but I hope to find here a wider audience for this issue. BTW https://github.com/LucHermitte/mu-template claims to support reindentation.