2

I have an environment for Theorem (aliased to "thm") When in VIM editor I write

"thm" followed by "F5" I get:

\begin{thm}

\end{thm}<++>

Can I edit the macro so that I get instead:

\begin{thm}<++>

\end{thm}<++>

It is the case in many theorems where we want to add the name of the theorem. For example: Roll's theorem....

with the cursor at the beginning?

6
  • Welcome to Vi and Vim!
    – filbranden
    Jun 4, 2020 at 17:27
  • 1
    This is probably a « snippet », so answers will need to figure out how latex suite is handling those
    – D. Ben Knoble
    Jun 4, 2020 at 20:02
  • Can you tell us which plugins you have installed? Especially which LatexSuite do you have, because duckduckgo returns several results.
    – statox
    Jun 5, 2020 at 10:24
  • @statox: I am not sure how to answer your question. I downloaded Tex-Suite. Installed under the directory .vim in my home directory. It has a directory called ftplugin, this has a directory called latex-suite, This directory has 32 files and directories. One of them is "envmacros.vim" . I believe that file is the one I need to edit. Jun 5, 2020 at 13:56
  • @HermanJaramillo My question was about where you downloaded TexSuite because there are several plugins which provide Tex features and to be able to help you we need to know which one exactly you are using.
    – statox
    Jun 5, 2020 at 15:26

1 Answer 1

1

I found the answer to my question. In the "envmacros.vim" file (under ~/.vim/ftplugin/latex-suite) I defined:

let g:Tex_Env_thm = "\\begin{thm}[<++>]\<CR><++>\<CR>\\end{thm}<++>"

then, when I type thm and push < F5> I get:

\begin{thm}[]
    <++>
\end{thm}<++>

The cursor located inside the square brackets []. If I do not want to name the theorem, I move with ctrl-j to the inside, and another ctrl-j to exit

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.