hi everyone the bad news is that the latest beta (or how I installed it) ended up deleting all my previous Custom snippets, macros etc. The good news I guess is that I'm re-doing them (not so many anyway) in a much better way :)
Separately I wanted to adapt the default SQL to colorize some of the COLLATE and CHARSET data, partly just as a tutorial. My CocoaMySQL creates table definitions including the following (unfortunately with the "`" included), e.g.:
`user` varchar(20) collate utf8_bin default NULL, [...] ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin
I wanted to offset the collate and CHARSET content so I cut-and-paste within the SQL bundle to create the following:
<dict> <key>foregroundColor</key> <string>#ff3300</string> <key>match</key> <string>^\s*\w+\s+(collate|utf8_bin|DEFAULT|CHARSET|utf8|COLLATE)\s*</ string> <key>name</key> <string>Charset Types</string> </dict>
Alas nothing happens ;) Could anyone give me a hand? This is hardly urgent, but I am just curious what I am doing wrong... FYI I based it on the following; I'm hardly a regex expert or anything but I thought I knew what was going on...
Thanks! Paul
<dict> <key>foregroundColor[1]</key> <string>#CCBA33</string> <key>match</key>
<string>^\s*\w+\s+(bigint|bigserial|bit|bit\svarying(\d+)|boolean|box |bytea|character\s(varying)? (\d+)|char(\d+)|var\schar(\d+)|cidr|circle|date|datetime|double\s precision|inet|int(\d+)|integer|interval(\d+)|line|lseg|macaddr|mon ey|numeric((\d+,\d+))? |oid|path|point|polygon|real|smallint|serial|text|times((\d+))(\swith outstimeszone)?|timestamp(s((\d+))(\swithoutstimeszone)?)? |varchar(\d+))\s*</string> <key>name</key> <string>Data Types</string> </dict>
On Jan 25, 2005, at 20:21, Paul Nordstrom August wrote:
the bad news is that the latest beta (or how I installed it) ended up deleting all my previous Custom snippets, macros etc. The good news I guess is that I'm re-doing them (not so many anyway) in a much better way :)
Okay -- hopefully TM wasn't to blame for this!?! :)
`user` varchar(20) collate utf8_bin default NULL, [...]
I wanted to offset the collate and CHARSET content so I cut-and-paste within the SQL bundle to create the following:
<string>^\s*\w+\s+(collate|utf8_bin|DEFAULT|CHARSET|utf8|COLLATE)\s*</ string>
This is matching: begin of line optional whitespace one or more word characters one or more whitespace characters one of your various elements
The problem is that your text is not only having one sequence of word-characters in front of the element names, it has “`user` varchar(20)”. I'd think that you can just delete the entire “^\s*\w+\s+” sequence (and also the trailing “\s*”).
hi Allan, thanks, it works like a charm! (It all makes sense when you explain it to a regex newbie... :)
I guess I'll have to save this variant somehow so it doesn't get overwritten by future SQL bundles... Hopefully I can figure that out on my own. Paul
On 27 Jan 2005, at 14:17, Allan Odgaard wrote:
`user` varchar(20) collate utf8_bin default NULL, [...]
I wanted to offset the collate and CHARSET content so I cut-and-paste within the SQL bundle to create the following:
<string>^\s*\w+\s+(collate|utf8_bin|DEFAULT|CHARSET|utf8|COLLATE)\s*< /string>
This is matching: begin of line optional whitespace one or more word characters one or more whitespace characters one of your various elements
The problem is that your text is not only having one sequence of word-characters in front of the element names, it has “`user` varchar(20)”. I'd think that you can just delete the entire “^\s*\w+\s+” sequence (and also the trailing “\s*”).
On Jan 27, 2005, at 15:09, Paul Nordstrom August wrote:
I guess I'll have to save this variant somehow so it doesn't get overwritten by future SQL bundles... Hopefully I can figure that out on my own.
Everything you edit/create in the bundle editor is stored in ~/Library/Application Support/TextMate/Bundles/
TextMate will correctly merge custom stuff with the default stuff, always using the custom stuff when there is a tie.
Each bundle and each item in a bundle has a global unique identifier which lets TextMate recognize stuff even when it gets renamed/edited. So for example if you install TextMate, rename the HTML bundle, delete 1 item from it and edit another, if you then later get a new version of TextMate with an updated HTML bundle, this updated HTML bundle will use your name, it will have the item you deleted hidden, the item you changed, changed, and the rest will be as distributed with TextMate (i.e. if there are new items, these will show up etc.).
I didn't really make a point out of this in the release notes, but it's a much improved system over the previous, where it just looked at directory names, and let user stuff take precedence.
This new system should hopefully appear very intuitive! I.e. it should feel like TextMate just stores the differences between the default stuff and the user changes, and use these differences in all future versions.