2

I am using Vim to write my LaTeX files, and figured I'd make a few snippets to help me along. It's been no problem writing simple snippets (like one for begin, one for figure etc.), but then when I tried making one to set the title (with a default value including some curly brackets ({and }), I have this problem. The goal of my snippet is that it creates the following text:

\title{My name\\\texttt{me@email.com}}

I want all the text inside the outmost curly brackets (the ones belonging to title) to be a placeholder. I try to accomplish this by writing the snippet as follows:

\title{${1:My name\\\texttt{me@email.com}}}${2}

My problem, however, is that snipMate seems to use only the name and the email (omitting the closing bracket for the texttt command) as a placeholder.

N.N.
  • 8,336
  • 12
  • 54
  • 94
sindrenm
  • 3,254
  • 3
  • 24
  • 30
  • I was going to edit your question to make the backquotes appear, but I'm not sure if that's what your snipped should create. Please edit it accordingly, and include a detailed example of what you want to create. – sidyll Oct 03 '11 at 18:49
  • Sorry, I misclicked the post button. I am updating the question now. – sindrenm Oct 03 '11 at 18:51

1 Answers1

1

SnipMate has some known problems with these things, the parsing for nested braces just doesn't work. Maybe someone knows how to do this, but in the meantime I suggest you creating two snippets, one for \title and another for \texttt — just to simplify things a bit.

snippet \ti
        \title{${1:My name}}

snippet \te
        \texttt{${1:me@email.com}}
sidyll
  • 57,726
  • 14
  • 108
  • 151
  • 1
    Thank you for your response. I guess I'll have to go with that, and just hope that snipMate will work this out in the future. :-) – sindrenm Oct 03 '11 at 19:47