Closed eekhof closed 10 months ago
I would like for vimtex completion to also add curly brackets when necessary, e. g. when I choose to complete
\fr
to\frac
, I would like to automatically get\frac{}{}
.
In this case, you probably want snippets, not completion. Snippets are a type of smart completion that converts an input to a dynamic template within which you can jump to different locations.
I personally like and use UltiSnips, but there are several alternatives these days. See :help vimtex-af-snippets
for some more info. I realize that it would be nice to improve the docs here somewhat. A better introduction is given by @ejmastnak, here: https://www.ejmastnak.com/tutorials/vim-latex/ultisnips/
I have searched for solutions to this, and all I found was recommendations to install [...] snippet engines.
Yes, that is indeed my recommendation!
Thank you for your help, I hope it is not bad etiquette to comment on a closed issue for this purpose.
No, definitely not. I don't mind comments on closed issues in general, except when the comment is unrelated or if you comment on very old issues that are likely to be more or less relevant.
Glad you found my reply helpful!
Description
I would like for vimtex completion to also add curly brackets when necessary, e. g. when I choose to complete
\fr
to\frac
, I would like to automatically get\frac{}{}
. Optimally I would like with my cursor to be put between the curly brackets, and able to jump between them with tab or similar in a VS-Code like fashion.I am not sure if I am overlooking something, but it seems to me this would be a common thing to want to do. I have searched for solutions to this, and all I found was recommendations to install other language servers, or snippet engines. I tried coc-texlab, but that didn't help. I also found a reddit post where a user had the same issue, but I couldn't manage to solve the problem myself by adding
"tex.autoComplete.addBrackets":true
the coc-settings either, and I can't imagine that such a common feature would not be somehow be available directly in vimtex.I would be thankful for any kind of help to steer me into the right direction.
Steps to reproduce
\fr
or\sec
\frac
or\section
Expected behavior
I would like to get completed to
\frac{}{}
or\sec{}
automatically.Actual behavior
The curly brackets do not show up.
Do you use a latexmkrc file?
No
VimtexInfo