[TxMt] html snippets, why the selected text part?

Charilaos Skiadas skiadas at math.uchicago.edu
Sun May 22 19:36:39 UTC 2005


On May 21, 2005, at 5:45 PM, Allan Odgaard wrote:

> On May 22, 2005, at 0:10, Charilaos Skiadas wrote:
>
>> I just realized that a snippet could have both a key equivalent and a 
>> tab trigger. Maybe then it would make sense to also bind all those 
>> snippets to the same key equivalent, maybe in fact Ctrl-Shift-W, in 
>> addition to their tab triggers?
>
> I think that would degrade the current “Wrap selection in tag” 
> snippet. Tags are generally 1-4 letters, so having to actually select 
> the tag from a list would require more key presses than just entering 
> the tag name (after doing ctrl-shift-W).

Good point. I'd rather have ctrl-shift-w work right away too.

> The thing about ${1:...}$0 is clearly a bug. The reason for putting 
> the selection inside is probably because these were all made from the 
> same copy, and then a user who does use one more than the others, 
> could give it a key equivalent.
>
> The actual necessity of these snippets is indeed questionable with the 
> ctrl-space macro. Though some do seem to expect them, and it isn't 
> more than a few days since someone complained that these were missing 
> in his version ;)
>
> As for changing the general “Wrap selection in tag” snippet to make 
> room for an argument, I personally wouldn't like that. Although my 
> production of HTML is more or less limited to what I put on my blog, 
> and here I just need to wrap text in p, tt, b, code, pre, em etc. The 
> only time I need an argument is for when I make links, and here I have 
> the “Link using selection” (ctrl-shift-L). I should probably update it 
> though (I initially did it when writing the documentation, which is 
> why it assumes the current word is a page.html).

Then how about two snippets, a "Wrap selection in tag", and a "wrap 
selection in tag with attributes"? Or perhaps an alternative to 
ctrl-space, which would allow you to enter an attribute too? I guess 
most of my html needs involve working on my homepage, and I find myself 
more often than not having to add an attribute to each tag, usually an 
id or a class.
But I guess that's what the regular snippets are, if you customize them 
a bit, which as you say is more of a personal taste. Though I do 
personally think that a generic "tag with attribute" snippet/command 
would be useful. But I guess this does depend a lot on how one uses 
html.
> Personally I've always seen the default stuff more as a good starting 
> point and inspiration than actually trying to cater to evrybodys 
> needs. The idea with TM is that you setup the stuff how you prefer it, 
> rather than adapt your working patterns to how it is setup by default. 
> That's one of the reasons why I try to make this is easy as possible 
> for the user to edit! :)

And that's indeed what I love about it! It's the first editor I found 
extremely easy to customize to my needs.
I must try to remember though, that my needs and workflow are different 
than other people's.
It might be a good idea maybe to have a page on the wiki, where people 
can write tutorials on how they've accomplished various things with 
snippets. Having lots snippets available is pretty convenient, but for 
some users having an explanation of what the various pieces of a 
snippet do might be more helpful, especially when they involve shell 
commands. IIRC, Eric started a page on shell tricks, though I haven't 
seen it used much. Maybe a similar thing for snippets, to augment the 
segment in the help file?
Just a thought, no idea if anyone would be interested in it.

Haris
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: text/enriched
Size: 3602 bytes
Desc: not available
URL: <http://lists.macromates.com/textmate/attachments/20050522/fa5516f5/attachment.bin>


More information about the textmate mailing list