Hi,
in my bundle, there are several hundred snippets. Is there any secret how I can make these dissapear from the menu at the bottom line of the window, left to the one with 'tab size: '? I'd like to list the interesting ones only.
Patrick
Patrick Gundlach wrote:
Hi,
in my bundle, there are several hundred snippets. Is there any secret how I can make these dissapear from the menu at the bottom line of the window, left to the one with 'tab size: '? I'd like to list the interesting ones only.
In the Bundle Editor, select the bundle and then drag the items you want to hide from "Menu Structure" to the "Excluded Items" list.
The snippets should still work and still appear in the ⌃⌘T list, but will not appear in any menu.
Henrik Nyh wrote:
Patrick Gundlach wrote:
Hi,
in my bundle, there are several hundred snippets. Is there any secret how I can make these dissapear from the menu at the bottom line of the window, left to the one with 'tab size: '? I'd like to list the interesting ones only.
In the Bundle Editor, select the bundle and then drag the items you want to hide from "Menu Structure" to the "Excluded Items" list.
The snippets should still work and still appear in the ⌃⌘T list, but will not appear in any menu.
Oops, I suppose snippets never appear in the ⌃⌘T list. Excluded commands will still be in that list, though.
Hello Henrik,
in my bundle, there are several hundred snippets. Is there any secret how I can make these dissapear from the menu at the bottom line of the window, left to the one with 'tab size: '? I'd like to list the interesting ones only.
In the Bundle Editor, select the bundle and then drag the items you want to hide from "Menu Structure" to the "Excluded Items" list.
This is exactly what I needed. I feel so stupid asking all these questions with such a simple answer.
Thanks!
Patick
On Mar 30, 2007, at 9:12 AM, Patrick Gundlach wrote:
Hello Henrik,
in my bundle, there are several hundred snippets. Is there any secret how I can make these dissapear from the menu at the bottom line of the window, left to the one with 'tab size: '? I'd like to list the interesting ones only.
In the Bundle Editor, select the bundle and then drag the items you want to hide from "Menu Structure" to the "Excluded Items" list.
This is exactly what I needed. I feel so stupid asking all these questions with such a simple answer.
Actually you might want to form groups instead, and have the snippets in there, so that they are still visible when you navigate the menu.
On this note, you might want to consider whether perhaps you could turn (some of) these several hundred snippets into one single command, that reads the selection or current word and acts accordingly. I find it extremely inefficient to have many snippets, especially if they do similar things. Suppose you decide that you want each of them to have an extra newline at the end or something. If they are all encapsulated inside a command, you'll just have to change the command. Otherwise, you have to change each of these snippets individually, quite a pain if there are really several hundred of them.
Thanks!
Patick
Haris Skiadas Department of Mathematics and Computer Science Hanover College
Hello Haris,
Actually you might want to form groups instead, and have the snippets in there, so that they are still visible when you navigate the menu.
That is what I do now.
If they are all encapsulated inside a command, you'll just have to change the command. Otherwise, you have to change each of these snippets individually, quite a pain if there are really several hundred of them.
They are all auto generated. So I could just regenerate them.
Just in case anybody is interested: this is for a ConTeXt bundle (a TeX macro package). These snippets are invoked by tab completion:
\color <tab> -->
\color [${1:...}]{${2:...}} $3
or a slightly more complex example:
\filllinrules <tab> -->
\fillinrules ${1:[${2:...,...=...,...}]}{${3:...}}{${4:...}} $5
This way the user can find out about possible arguments and if they are optional or not.
Patrick
On Mar 30, 2007, at 10:42 AM, Patrick Gundlach wrote:
Hello Haris,
Actually you might want to form groups instead, and have the snippets in there, so that they are still visible when you navigate the menu.
That is what I do now.
If they are all encapsulated inside a command, you'll just have to change the command. Otherwise, you have to change each of these snippets individually, quite a pain if there are really several hundred of them.
They are all auto generated. So I could just regenerate them.
Just in case anybody is interested: this is for a ConTeXt bundle (a TeX macro package).
Ah, in that case have you looked at how we do this in the LaTeX bundle, and if so, is there any reason not to use the same system? I.e. you would type for instance "col" and then cmd-}, and it would become \color {${1:.......
These snippets are invoked by tab completion:
\color <tab> -->
\color [${1:...}]{${2:...}} $3
or a slightly more complex example:
\filllinrules <tab> -->
\fillinrules ${1:[${2:...,...=...,...}]}{${3:...}}{${4:...}} $5
This way the user can find out about possible arguments and if they are optional or not.
Patrick
Haris Skiadas Department of Mathematics and Computer Science Hanover College
Ah, in that case have you looked at how we do this in the LaTeX bundle,
not before, but I just did now.
and if so, is there any reason not to use the same system?
well, I personally like to have tab completion, I can't see how this would work without having the command names as a snippet.
I guess it's just a matter of taste, right?
Patrick
Thanks for the feedback, btw.
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.
On the other hand, the command has a very important advantage. Suppose I want to create an itemize environment. I can do this with current word either "it", or "item" or "itemize". Any of them would work. Same for "equation", which can be triggered by "eq", "eqn" or "equation". You can't have multiple triggers for the same snippet unless you duplicate it.
Another advantage is that the same keyword can be used for both environments and commands, with different behavior each time. For instance typing "it" and then cmd-shift-{ creates an itemize environment, while if instead we use cmd-shift-} we would get \textit. So you can use the same shortcuts as long as you are working in different contexts, and so all abbreviations can be kept short.
I guess it's just a matter of taste, right?
To a large extend, yes. Though for bundles in the repository we have some guidelines we try to follow, and not having a gozillion snippets when a single command would do is one of them.
TextMate needs to load and keep track of all the snippets for activated bundles at all times, since at every key press it needs to determine if one of these needs to be called. So if every bundle created these gozillions of snippets, as I am sure they would like to, I think this would actually have a performance hit for TextMate. Especially for the bundles that don't ship with TM, which are saved in XML format instead of binary, so even just loading them takes some (admittedly not too much) time.
Patrick
Thanks for the feedback, btw.
Haris Skiadas Department of Mathematics and Computer Science Hanover College
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.
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
Charilaos Skiadas wrote:
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. ⋮ 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.
Thanks for explaining.
On 30. Mar 2007, at 18:14, Charilaos Skiadas wrote:
[...] TextMate needs to load and keep track of all the snippets for activated bundles at all times, since at every key press it needs to determine if one of these needs to be called. So if every bundle created these gozillions of snippets, as I am sure they would like to, I think this would actually have a performance hit for TextMate. Especially for the bundles that don't ship with TM, which are saved in XML format instead of binary, so even just loading them takes some (admittedly not too much) time.
It actually lazy-loads bundle items as needed. It caches the name, scope selector, and activation in an index file which is loaded at startup (though it has to go through the bundles folders to check if any bundles were updated since the index was last generated, which is still a big factor faster than actually having to load each item) -- the index is saved as ~/Library/Caches/TextMate/Bundle Index -- mine is presently just below one megabyte.