[TxMt] Re: How to open files with no extension in Quicklook/Textmate (Ciaran's plugin) & Thank You Allan!

Allan Odgaard mailinglist at textmate.org
Sun Jan 2 18:39:07 UTC 2011


On 20 Dec 2010, at 16:25, Brandon M Fryslie wrote:

> […] *what is the status on true multikey bindings?*

I am afraid they are limited to the extent that you already seem to be aware. I think multi-stroke key bindings are the result of an Emacs user writing the NSTextView class and adding a few Emacs features to this, which have been “generalized” via the DefaultKeybindings.dict, but effectively it really is just NSTextView supporting it (and TextMate’s custom text editor replicating most of it).

> […] *What's the opinion on AppleScript for that?  Can it be done reasonably
> fast in the background?  *

The main speed issue with AppleScript is starting up the environment, I think because it has to read all the scripting dictionaries. Though on Snow Leopard using ‘osascript’ is down to 0.116s on my system, so Apple has probably worked on addressing this.

> […] *what tools should I be using to write a regex for use in the language definition?*

Uhm… there are a few regexp test tools, but I don’t personally have experience with them.


> While awesome and useful, I find (especially large) regex's incredibly ugly and unintuitive.    I would like
> to have a better syntax

Are you aware of the extended mode? You can prefix the regexp with (?x) which makes it ignore whitespace and allow comments with ‘#’.

For example the rule to match C format string placeholders (like ‘%d’) looks like this:

    {   name = 'constant.other.placeholder.c';
        match = "(?x)%
                (\d+\$)?                             # field (argument #)
                [#0\- +']*                           # flags
                [,;:_]?                              # separator character (AltiVec)
                ((-?\d+)|\*(-?\d+\$)?)?              # minimum field width
                (\.((-?\d+)|\*(-?\d+\$)?)?)?         # precision
                (hh|h|ll|l|j|t|z|q|L|vh|vl|v|hv|hl)? # length modifier
                [diouxXDOUeEfFgGaACcSspn%]           # conversion type
            ";
    },

It might still be a little arcane, but at least it has structure and comments.

> […] *I'm unable to find a method by which to show all commands of a certain binding in every scope.  Is there such a command?*

There is not, no.

> I plan to write an application to keep track of system wide keyboard
> shortcuts and this would be very useful.

It is possible to scan the bundle items on disk and gather the info that way. The format for the keyEquivalent value is like in DefaultKeybindings.dict. Let me know if you need more info.

> Thanks again […]

Thanks for the positive feedback :) Sorry I can’t be more helpful wrt. your questions and sorry about the delay in replying.



More information about the textmate mailing list