[TxMt] Nested snippets

Brad Miller bonelake at mac.com
Fri May 20 13:17:50 UTC 2005


Haris,

I find that I rarely make it through a multi-part snippet without  
doing something that breaks me out of snippet-tab-mode.  Then I fill  
in the rest of the snippet template by navigating to the pieces in  
the usual way.  Maybe I just have an unusually short attention span,  
or I am an exceptionally erratic typist, not sure.
Anyway, usually by the end of the first template variable I've  
managed to get it so that tabs are just tabs.

I think that in a \begin \end environment like the one in your  
example, the $0 between the begin/end is the way to go. Usually  
people are going to do a fair amount of typing in between.

I think its important to remember that Snippets help two completely  
different classes of user.

1. Novices -- advanced beginners:  Snippets help them create basic  
language constructs that they otherwise don't know how to do without  
spending time in the manual.  How do I make a table?  How do I insert  
a figure? etc.  These users are most likely going to select snippets  
from the menu.

To this end, I'd like to see Allan add the ability to create  
categories and subcategories of snippets that result in menus/ 
submenus if snippets.  IMHO the snippets menu is useless for  
languages like Actionscript and OCaml because there are too many  
entries (screens of them)

2. language power users : These users already know the syntax for  
creating a table, the snippet is just helping this class of users go  
faster.  These users are going to use tab completion.  These users  
are going to be most annoyed when things don't behave logically.  (at  
least as far as they understand the workings of things)

Here's the one that annoys me the most:  (and I've just now figured  
out how to fix it since I've been writing this email :-) )

\begin{itemize}
   \item ${1:premier item}
   $0
\end{itemize}

Here's my typical use pattern with the above:

itemize<tab>
type in first item, <return>
item<tab>
At this point I end up on the next line with the word item on a line  
by itself
crap, why does this do this?
- Why isn't TM smart enough to read my mind and understand when I'm  
ready to move on to a new snippet?
- Why aren't I smart enough to understand TM's rules for deciding I'm  
not in snippet-tab-mode anymore.

Personally, I think <return> ought to do it.

Now, I've modified my copy of itemize to be:
\begin{itemize}
   \item ${0:premier item}
\end{itemize}

Now things behave like I would like them to. I think I'll commit this  
new itemize, and fix up the other list making environments as well.

As to your other question about theorems and definitions, I say add  
them so that they are there to help people get better with Latex.

Brad


On May 19, 2005, at 9:30 PM, Allan Odgaard wrote:

> On May 20, 2005, at 0:35, Charilaos Skiadas wrote:
>
>
>
>> 3) If there is no workaround, do people have a preference on which  
>> of the two situations is more useful?
>>
>
> Probably depends on the situation ;)
>
> ______________________________________________________________________
> For new threads USE THIS: textmate at lists.macromates.com
> (threading gets destroyed and the universe will collapse if you don't)
> http://lists.macromates.com/mailman/listinfo/textmate
>




More information about the textmate mailing list