http://bradchoate.com/downloads/Movable%20Type.tmbundle.zip
Features:
* Syntax highlighting for MT templates * Scope of MT container tags: entity.name.tag.mt, scope of MT variable tags: variable.other.mt * Common MT 3.2 default templates provided as new file templates * A couple of snippets * A context-sensitive help command for MT tags
This is my first bundle, so I'm still learning, but I'm very impressed with what you can do with TextMate bundles. This is the kind of power I've been looking for in an editor. Feedback is most welcome.
A few questions:
- MT templates are usually HTML based templates, so I invoke the HTML bundle rules too-- however, some MT tags aren't syntax highlighted properly since they're really "embedded" in the HTML syntax. For example:
<tag><$MTTag$></tag>
That's no problem. But this isn't processed right:
<tag attribute="<$MTTag$>">
The embedded mt tag is never seen. Is there a way to handle this without modifying the HTML bundle itself?
- When you create a new file using one of the supplied MT file templates, the syntax mode is left as HTML, not Movable Type. Is there a way to force the Movable Type syntax?
- I wish it were more obvious how to customize the colors for the MT tags. The user has to set these up manually. If TextMate were to scan for available scopes and at least list them as inactive in the color preferences tab, that would be phenomenal.
- What on earth is the key to use for the TextMate "Edit in TextMate" service? It looks like Command + A caret with a bar on top of it. What is that key? I also can't make out the key shown for Ruby's "embed string variable" snippet. Or the key to use for the "Web Searches" bundle.
Thanks! -Brad
On 2/12/2005, at 4:49, Brad Choate wrote:
- MT templates are usually HTML based templates, so I invoke the
HTML bundle rules too [...]
<tag attribute="<$MTTag$>">
The embedded mt tag is never seen. Is there a way to handle this without modifying the HTML bundle itself?
There currently is not, but the need arise from time to time, so eventually I'll need to add some way to inject (and override nested) rules in the included language grammar.
- When you create a new file using one of the supplied MT file
templates, the syntax mode is left as HTML, not Movable Type. Is there a way to force the Movable Type syntax?
If the MT templates do not have their own extension (or can be matched via the firstLineMatch) then there is not. Though TextMate does support double-extensions in the fileTypes array for the language grammar, so you could e.g. suffix them with .mt.html (if they do need to have .html last).
- I wish it were more obvious how to customize the colors for the
MT tags. The user has to set these up manually. If TextMate were to scan for available scopes and at least list them as inactive in the color preferences tab, that would be phenomenal.
I'm afraid there are far to many scopes for this to have any practical value. But somehow showing a sample and allowing the user to click elements to get the scope, could be a future solution.
- What on earth is the key to use for the TextMate "Edit in
TextMate" service?
It's the enter key on the numeric keypad. Fn-return on laptops.
I also can't make out the key shown for Ruby's "embed string variable" snippet.
This one is the normal hash-mark/pound sign: # (shift 3 on US keymap). The snippet is scoped to only work inside Ruby strings, so only inside such string will # insert the snippet (which wraps the selection, if there is one).
Or the key to use for the "Web Searches" bundle.
That's the Help key. I think some keyboards lack that key.
On Dec 2, 2005, at 2:29 AM, Allan Odgaard wrote:
On 2/12/2005, at 4:49, Brad Choate wrote:
- When you create a new file using one of the supplied MT file
templates, the syntax mode is left as HTML, not Movable Type. Is there a way to force the Movable Type syntax?
If the MT templates do not have their own extension (or can be matched via the firstLineMatch) then there is not. Though TextMate does support double-extensions in the fileTypes array for the language grammar, so you could e.g. suffix them with .mt.html (if they do need to have .html last).
The language definition lists 'mtml' as an extension for MT templates and the file templates all have 'mtml' as their extension. Anything else?
- I wish it were more obvious how to customize the colors for the
MT tags. The user has to set these up manually. If TextMate were to scan for available scopes and at least list them as inactive in the color preferences tab, that would be phenomenal.
I'm afraid there are far to many scopes for this to have any practical value. But somehow showing a sample and allowing the user to click elements to get the scope, could be a future solution.
At the very least, the input field for typing the scope could provide an autocomplete for listing the recognized (but unused) scopes. It could also indicate which bundle the scope comes from. Ie, upon typing "entity.", I would see a drop down list showing (among others):
entity.name entity.name.tag (HTML) entity.name.tag.mt (Movable Type)
-Brad
On 2/12/2005, at 18:08, Brad Choate wrote:
If the MT templates do not have their own extension [...]
The language definition lists 'mtml' as an extension for MT templates and the file templates all have 'mtml' as their extension. Anything else?
ah… the problem is that the HTML grammar defines a first line match on the DOCTYPE, which has precedence over extension-based language association.
If however you manually switch to MT for a *.mtml file, it will bind *.mtml files to your MT grammar, overriding the first line binding from the HTML bundle.