0

Well, I'm under Mac OS X and I use TextMate 1.5.11 to compile LaTeX documents. But I've found that Sublime Text 2 has some features I like more than TextMate (and also TM v2, which is in beta). TextMate 2 has some of that features, but it's still buggy.

So, I would like to move to ST2, but there is only one thing which stops me. In TM there are four very different ways of understanding the snippets:

  • True snippets which you introduce with tab key after writing a word. (i.e. if you write mat and then press tab you get the basic matrix environment)
  • Commands based on the word (i.e. if you write frac then you get \frac{$0}{$1})
  • LaTeX symbol based on current word (i.e. if you write a then you get \alpha, and if you press again, in some cases, it becomes cyclic with more than one symbol)
  • Environment based in current word (i.e. if you write document and you press the keys assigned your get \begin{document} $0 \end{document})

But in ST2 you only can press tab. I wold like to differentiate this four cases. Is there an easy way of setting Sublime Text up this way? (I know nothing about programming)

Manuel
  • 301
  • 2
  • 11

1 Answers1

1

I just made the same switch from TM to ST2 and I'm mostly using it to write LaTeX. First you need to install the packet installer Package Control - the Sublime Text package manager. With this installed you invoke Package Control with cmd+shift+p fuzzy search "install package" hit enter, search for "LaTeXTools" and install it. Now you have a lot of what you know from the LaTeX bundles in TextMate. Study the readme where the developer gets into all the different key commands.

  • mat+TAB will work out of the box. A lot of other things you expect as well.
  • word based commands are called Key Bindings and can be configured in Preferences > Package Settings > LaTeXTools > Key Bindings User. I am myself not quite sure of the syntax there. But you can invoke commands with every key combination you can think of. Just typing a word, using a trigger like TAB or whatever floats your boat.
    (btw. I'm not sure if you have to put Key Bindings you just want to use in LaTeX in the Key Bindings file inside the LaTeSTools package. Could be that you can define the scope inside the global Key Bindings - User file.)
  • I am not aware of that behavior in TM. I do this with TextExpander. Just hitting a+TAB = \alpha but I'm sure you can do this in Key Bindings as well
  • There is an environment command in LaTeXTools. Just type your environmens name and then hit CMD+l,e. That is CMD+l then leaving the CMD key and then type the letter l. Yes, ST can do this.

So, if you'd like to put an enumerate environment you have at lease two options.

enum+TAB gives you

\begin{enumerate}
     \item 
\end{enumerate}

enumerate CMD+l,e gives you

\begin{enumerate}

\end{enumerate}

There is one other handy command. CMD+l,c turns the previous word into a command. So hat CMD+l,c gives you \hat{}.

sebastian
  • 478
  • 8
  • 22