Just a proposal regarding the snippets.
It would be most useful if the snippets were only active when their respective mode is active. This way, the same trigger could be used for various modes and applications.
For example, the trigger "table" being already used for html, it cannot be currently used for Latex. However, if the triggers were tied to a mode, we could use the same trigger, simplifying our lifes.
Greetings,
Normand Mousseau
On 14 Oct 2004, at 20:21, profprof@mac.com wrote:
Just a proposal regarding the snippets.
It would be most useful if the snippets were only active when their respective mode is active. This way, the same trigger could be used for various modes and applications.
Wow, I was just about to post the exact same suggestion on the wiki. I'll still post it there anyway, assuming you haven't beaten me to it :-)
For example, the trigger "table" being already used for html, it cannot be currently used for Latex. However, if the triggers were tied to a mode, we could use the same trigger, simplifying our lifes.
I was thinking of 'if'; just about every language supports some kind of 'if' statement, so there's huge potential for clashes there, and with just about every other control structure, in fact.
Rich Barton
On 14. Oct 2004, at 21:21, profprof@mac.com wrote:
It would be most useful if the snippets were only active when their respective mode is active. This way, the same trigger could be used for various modes and applications.
The problem with this is that you wouldn't be able to have general snippets, and it would require you to set a "belongs to" for each snippet.
I'm not completely rejecting the idea (since I definitely do not think the current solution is ideal).
What I would however propose is, that when multiple snippets match, it will use the snippet from the same bundle as the current syntax rules -- if there is none, a menu will show.
This should allow for general snippets, and in most cases will solve the ambiguity.
There's still one problem though, for example we have a HTML bundle which may contain some HTML snippets, but the PHP bundle has a _new_ HTML syntax file, so HTML (PHP) would _not_ treat snippets from the HTML bundle with higher priority than any other snippets.
Though this would probably be solved when I do style sheets, since the PHP bundle would then not define the HTML syntax (again), but only create a new style sheet for the existing HTML syntax.
How does that sound?
Kind regards Allan
Op 14-okt-04 om 21:44 heeft Allan Odgaard het volgende geschreven:
On 14. Oct 2004, at 21:21, profprof@mac.com wrote:
It would be most useful if the snippets were only active when their respective mode is active. This way, the same trigger could be used for various modes and applications.
The problem with this is that you wouldn't be able to have general snippets, and it would require you to set a "belongs to" for each snippet.
I'm not completely rejecting the idea (since I definitely do not think the current solution is ideal).
What I would however propose is, that when multiple snippets match, it will use the snippet from the same bundle as the current syntax rules -- if there is none, a menu will show.
This should allow for general snippets, and in most cases will solve the ambiguity.
There's still one problem though, for example we have a HTML bundle which may contain some HTML snippets, but the PHP bundle has a _new_ HTML syntax file, so HTML (PHP) would _not_ treat snippets from the HTML bundle with higher priority than any other snippets.
Though this would probably be solved when I do style sheets, since the PHP bundle would then not define the HTML syntax (again), but only create a new style sheet for the existing HTML syntax.
How does that sound?
Sounds good, if you could also do it for commands and macros :-)
On Thursday, October 14, 2004, at 04:45PM, Jan Sabbe jan.sabbe@student.kuleuven.ac.be wrote:
Op 14-okt-04 om 21:44 heeft Allan Odgaard het volgende geschreven:
On 14. Oct 2004, at 21:21, profprof@mac.com wrote:
It would be most useful if the snippets were only active when their respective mode is active. This way, the same trigger could be used for various modes and applications.
The problem with this is that you wouldn't be able to have general snippets, and it would require you to set a "belongs to" for each snippet.
I'm not completely rejecting the idea (since I definitely do not think the current solution is ideal).
What I would however propose is, that when multiple snippets match, it will use the snippet from the same bundle as the current syntax rules -- if there is none, a menu will show.
This should allow for general snippets, and in most cases will solve the ambiguity.
There's still one problem though, for example we have a HTML bundle which may contain some HTML snippets, but the PHP bundle has a _new_ HTML syntax file, so HTML (PHP) would _not_ treat snippets from the HTML bundle with higher priority than any other snippets.
Though this would probably be solved when I do style sheets, since the PHP bundle would then not define the HTML syntax (again), but only create a new style sheet for the existing HTML syntax.
How does that sound?
This sounds like an elegant solution. It would give much more flexibility to the system. As was suggested by somebody on the Wiki page, this could be combined with a classification.
So, if in Latex, I want to generate a table, I type:
table[tab]
If I wanted to include an HTML snippet in Latex mode, then I might type:
html:table[tab]
If the command is not found in Latex, and only in another mode, then it is found without having to specify the type.
Normand Mousseau
On Oct 14, 2004, at 21:59, profprof@mac.com wrote:
This sounds like an elegant solution. It would give much more flexibility to the system. As was suggested by somebody on the Wiki page, this could be combined with a classification.
I believe the above mentioned suggestion was made by me, so I should comment on it further.
So, if in Latex, I want to generate a table, I type:
table[tab]
If I wanted to include an HTML snippet in Latex mode, then I might type:
html:table[tab]
If the command is not found in Latex, and only in another mode, then it is found without having to specify the type.
Ideally the 'joiner' character between "html" and "table[tab]" in the above examples should be a single key stroke, rather than the ' : ' which is a two-key keystroke. Although looking through the keyboard I don't find many good candidates.
The way I see things, perhaps wrongly so, is that each user can create their default bundle that contains all the common language syntax files that they use on a regular basis.
In my case these would primarily be: HTML, PHP, CSS and JavaScript
So in the Snippets folder - and Snippets editor window - there would ideally be a sub-directory/grouping called: HTML => for html based snippets PHP => for PHP related snippets CSS => for CSS related snippets JS => for JavaScript related snippets
Since the HTML syntax file is the host file - that embeds the other language syntaxes - this would be the default syntax for a .html file, and TM would (hopefully) know what mode we are currently in where the cursor is, and therefore by typing:
table[tab]
while in HTML mode would collect the "table" snippet from the HTML directory/grouping, even though we may have a snippet by that name in each of our sub-dirs/groupings.
IF we for some reason would wish to override the default action, then we can type:
PHP:table[tab] or <groupingID>:< snippetName>
My ideal scenario would be to have a structure something like the following:
Snippets/ /HTML/ /div/ header = basic HTML snippets footer sidebar
/PHP/ /div/ header = basic HTML & PHP snippets footer sidebar
If we had the above we would type:
php:div:header to collect the header snippet in the div grouping in the php grouping.
Why would I want to have it like this ?? Well, I have found that developing web sites I use similar snippets of code but with varied elements inside, so by having the ability of having multiple snippets in sub-groups we can have a snippet group for each type of project we are working on. In one project we may use a simple header div with just a simple logo text in there, whereas in another project we might have a lot more information in there.
Just my 2 pence worth : )
Kind regards,
Mats
On 15 Oct 2004, at 12:53, Mats Persson wrote:
On Oct 14, 2004, at 21:59, profprof@mac.com wrote:
I believe the above mentioned suggestion was made by me, so I should comment on it further.
Similar to yourself - I find myself editing Javascript, wrapped in HTML, wrapped in Python. This seems like a good solution ..
Ideally the 'joiner' character between "html" and "table[tab]" in the above examples should be a single key stroke, rather than the ' : ' which is a two-key keystroke. Although looking through the keyboard I don't find many good candidates.
Is there any reason not to use '/' as a delimiter ?
The way I see things, perhaps wrongly so, is that each user can create their default bundle that contains all the common language syntax files that they use on a regular basis.
... snip 8<---- ...
If we had the above we would type:
php:div:header to collect the header snippet in the div grouping in the php grouping.
Would it be possible to use an incremental match - to keep the number of keypresses required to a minimum? So that you just need to type enough of each groupingID / snippet name for it to be a unique match.
-- Andre
On 15/10-2004, at 15:20, Andre Posumentov wrote:
Would it be possible to use an incremental match - to keep the number of keypresses required to a minimum? So that you just need to type enough of each groupingID / snippet name for it to be a unique match.
This could, however, lead to problems when you really want to type something followed by a tab, if all kinds of prefixes to snippet triggers are considered as well.
Something, that I would like is a palette with buttons, grouped by bundle, which you can click on to perform the snippet. Similar to the BBEdit palette. I know, I know, I should really get over it, but it would be helpful, especially if you've got a crap load of snippets.
-Noel