[TxMt] Re: exclude snippets from menu

Charilaos Skiadas skiadas at hanover.edu
Fri Mar 30 20:31:02 UTC 2007


On Mar 30, 2007, at 2:58 PM, Henrik Nyh wrote:

> Charilaos Skiadas wrote:
>> On Mar 30, 2007, at 11:05 AM, Patrick Gundlach wrote:
>>> well, I personally like to have tab completion, I can't see how this
>>> would work without having the command names as a snippet.
>>>
>> Yes, tab completion is indeed nice and I like it too,  
>> unfortunately there is no easy way to have both worlds.
>
> I reckon I'm misunderstanding you, but just in case: a command can  
> be triggered by a tab trigger (like a snippet), and output its  
> results as a snippet.

You are misunderstanding me, this would still require a different  
command for every tab trigger. I am talking about a single command,  
that would have to be activated on tab, receiving as input the  
current word, and looking up the word in a hash/dictionary and  
inserting the appropriate snippet in. For an imaginary example,  
suppose you have the two snippets with tab triggers:
trigger: "it"
output: "hi there"

and
trigger: "is"
output: "hi to you too"

Then you could instead have a command, triggered on tab, which  
basically does:

if current word is "it", then print "hi there". If it is "is", then  
print "hi to you too".

Now imagine 100 snippets instead of 2.

Problem is that this effectively takes over the tab key and  
effectively disables all tab triggers. Hence we have to use another  
shortcut for the command, which makes it a bit unnatural since one is  
used to trigger these things via tab. Look at "LaTeX -> Insert  
Command Based on Current Word" and "LaTeX -> Insert Environment Based  
on Current Word" for examples of these kinds of commands.

Haris Skiadas
Department of Mathematics and Computer Science
Hanover College







More information about the textmate mailing list