3

I recently installed the snipmate plugin, and I'm having a hard time understanding how it works. I have this in my tex.snippets file:

snippet begin \begin{} ... \end{} block
        \\begin{${1:env}}
                ${0:${VISUAL}}
        \\end{$1}

I am trying to master these snippets to improve my workflow. However, I don't understand how it works. When I press Tab, I have this

\begin{document}
$
\end{document}

This dollar sign appears in every tag. What is the keybinding behind it?

  • Shift + 4 ... OK fine, fine, I'll take my coat... – percusse Nov 28 '17 at 8:12
  • The dollar sign isn't valid LaTeX in this context. Where did you find this code snippet? – A Gold Man Nov 28 '17 at 13:15
  • Vim snipmate plugin that has a library of it. I have to reedit the tex.snippet file. I dont know what the author try to achieve in this snippet – vincent pham Nov 28 '17 at 13:28
  • This isn't part of vim-latex, it's part of a different plugin. I'm going to edit your question and then answer it. – A Gold Man Nov 30 '17 at 21:37
3

The $ sign is a placeholder for where your cursor goes. The way the snipmate plugin works is that when you type in the keyword (begin in our case) and then press the trigger key (Tab by default), it fills in the snippet.

What follows is that you get

\begin{env}
   $
\end{env}

where your cursor is first placed where it say env, so you can type the name of the environment. Then, you can press the GoToNext key (also Tab by default) to move to the next placeholder, which is the $. Then you just type as normal and the $ sign disappears.

In terms of reading the snippets, the dollar signs represent where the placeholders will be put. You should really read the documentation that comes with the package, which is also available on the github page for the plugin.

  • Thanks for the info. I am looking for a good book that I can spend time with more like a latex cookbook rather than quick editing tutorials online. What would recommend? – vincent pham Dec 2 '17 at 5:33
  • @vincent the latex companion is old, but a good intro. I think the best way to learn is to keep your eyes open and hang out on stackexchange. by the way, you can accept an answer if it solved your problem by clicking the check mark next to it. – A Gold Man Dec 2 '17 at 17:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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