[TxMt] oniguruma is your friend!!!!
thomas Aylott
thomas.42 at gmail.com
Mon Sep 26 05:43:53 UTC 2005
I love you oniguruma!!!!!
I must be seriously stinking geeky to find the most enjoyment in life
(besides obvious things ;) ) from regular expressions, SQL & syntax
coloring.
That can't be healthy.
But, anyway...
Quick snazyness you can now do with your friend oniguruma:
Turn the entire document into a snippet! WOO!
Record a macro that searches for:
(?<==")[^"]*(?=")|(?<==')[^']*(?=')
Save it.
Give it a scope of 'meta.tag, declaration.tag' (or more specifically
'text.html meta.tag -source, text.html declaration.tag -source').
Give it a shortcut of option-tab.
SHEBANG! Your HTML is now a giant snippet.
This wasn't possible before because the search regex wasn't
compatible with zero-width-positive-lookbehind.
But our new friend oniguruma has given us even more super-powers.
It's like being superman and someone handing you green lanterns ring.
---
I have attached the Macros that I've created HTML Attribute NEXT &
PREV, HTML Attribute Value NEXT & PREV. I also made a quick HTML
Attribute ADD Snippet & Macro that goes to the end of the current tag
and adds a generic html snippet to the end, but i didn't include that
one.
SLIGHT PROBLEM: (oh, you knew it was coming)
I wanted to implement using the tab key to tab to the next occurrence
of the next type of thing you have selected (inside an attribute
value tabs to the next attribute value; inside an attribute name tabs
to select the next attribute name value pair, etc..)
The two problems are:
1: We need to have dynamic scopes.
Taking over the tab key equivalent takes it away from snippets too.
If I have a command that runs inside of HTML attribute values. My
HTML snippets stop working properly.
We need some way of eliminating those commands and such from inside
of running snippets.
The dynamic.snippet scope you mentioned earlier would be ideal for
this situation. You could even have running snippets have a special
color.
I love being able to do boolean logic with scopes. SWEET!!!
2: Selections carry the scope of the last character selected.
I tried to set a macro for next html attribute & next html attribute
value. Once you tab to the first html value (EG: name="value") it
picks up the scope of the string (the " being the last character in
the selection.) Then only the next html attribute value macro (EG:
the value in name="value") would fire when hitting the command twice.
The workaround I made was to either:
A) Change the html attribute value deal to select the space after the
closing quote mark (thereby changing the scope of the selection back
to html attribute). This didn't work because there is no space to
select at the end of an attribute and it was just 'wrong' in my opinion.
B) Change the key equivalent of one of them to something else. This
is what i've chosen.
I'm not sure if this one is really the wrong behavior or what. It
seems logical to pick up the scope of the last character selected. I
can't really think of any other way of handling that.
All in all... I am so incredibly delighted... Oh yes. so much.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: HTML Attribute NEXT.plist
Type: application/octet-stream
Size: 1038 bytes
Desc: not available
URL: <http://lists.macromates.com/textmate/attachments/20050926/2713f8f6/attachment.plist>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: HTML Attribute Value NEXT.plist
Type: application/octet-stream
Size: 1056 bytes
Desc: not available
URL: <http://lists.macromates.com/textmate/attachments/20050926/2713f8f6/attachment-0001.plist>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: HTML Attribute Value PREV.plist
Type: application/octet-stream
Size: 1144 bytes
Desc: not available
URL: <http://lists.macromates.com/textmate/attachments/20050926/2713f8f6/attachment-0002.plist>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: HTML End Tag <:.plist
Type: application/octet-stream
Size: 674 bytes
Desc: not available
URL: <http://lists.macromates.com/textmate/attachments/20050926/2713f8f6/attachment-0003.plist>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: HTML Attribure PREV.plist
Type: application/octet-stream
Size: 1042 bytes
Desc: not available
URL: <http://lists.macromates.com/textmate/attachments/20050926/2713f8f6/attachment-0004.plist>
More information about the textmate
mailing list