On 12 sept. 06, at 15:17, Charilaos Skiadas wrote:
Well, I was actually kidding, but if you do want to do this the simplest thing would be to create a new snippet with key equivalent $, and with text: “( $TM_SELECTED_TEXT$1 )” without the quotes. Then you can tab out of the math environment, provided you don't use a different snippet while in there. This also allows you to enclose something in a math environment simply by selecting it and then pressing $.
The only thing remaining is an easier way to get out of the math environment, perhaps by pressing $ anywhere in an existing math environment. You could that by a macro that searches for a regular expression (?<=\))
This is just an idea, it has some problems that would need to be smoothed out. First of all, inserting an actual dollar sign is more difficult, but we could allow it by having the above not work after a slash (for escaped dollar signs) and not work in verbatim environment. (see http://macromates.com/textmate/manual/ scope_selectors#scope_selectors, section 13.3)
second, I often find that while in math, I use $ to split a math formula in two. So perhaps inside a math environment it might be best for $ to do that.
All these would, if they become official in any way, go into the separate LaTeX Experimental bundle, so that people who do not want them could disable them.
Another simpler thing you can do, which doesn't conflict with the use of $, is to create a snippet, with tab trigger (, which would insert “\( $0 \”, without the quotes. It's not perfect, but it's a start. Try it out and see if it works. You would need to press a tab after the ( of course. One could instead set the snippet to have a key equivalent of (, have a scope that only triggers it when the caret is after a \ (which is actually not too easy to do now that I think about it), and have its text be “( $1 \)” without the quotes.
Thanks for these suggestions. I'm still very new to TextMate customization (I only created a small bundle for some very specific files I often edit), but I'll definitely explore these solutions.
Thanks again,
Alan
-- Alan Schmitt http://alan.petitepomme.net/
The hacker: someone who figured things out and made something cool happen. .O. ..O OOO