[TxMt Plugins] Re: Redefining Word Characters via OakWordCharacters
Gerd Knops
gerti-textmate at bitart.com
Wed May 26 15:39:32 UTC 2010
On May 26, 2010, at 10:26 AM, Allan Odgaard wrote:
> On 26 May 2010, at 16:57, Bastien Dejean wrote:
>
>> I would like to be able to redefine which characters constitute a word inside a bundle.
>> I was wondering if the following approach might worth the try : [...]
>>
>> – create a shell variable inside the bundle called TM_WORD_CHARACTERS ;
>> – replace (using jr_swizzleMethod) the isWordCharacter method of the OakWordCharacters class : if the above variable don't exist call the original method.
>
> I doubt this would work well — it is however a known request and something which I’ll likely support in the future.
>
> My idea for how to support it is to have bundles be able to specify a character “type” for a scope (like with other scoped preferences).
>
> A type is simply a string with some predefined values (like ‘word’, ‘punctuation’, and ‘whitespace’) but it can effectively be anything.
>
> This way a grammar can match e.g. “\d+(\.\d+){3}” (IP address) and set the type either to ‘word’ or simply ‘ip-address’ and TM will treat it as a single unit when double-clicking or moving caret with the option key.
>
> Anyway… just what I have been pondering — I know this request is big with Gerd, not sure if he is on this list and wants to comment.
>
What do you want me to say other than I hope the future hurries up and gets here? ;-)
The above seems like a very powerful approach to me. Seems to work for all cases I can think of right now, and a per-scope rule is infinitely more flexible than a per language setting of word characters.
Gerd
> Also don’t know if this will suffice for your lisp bundle as I didn’t understand if ‘char=/’ was one unit or it means something else?
>
>
> _______________________________________________
> textmate-plugins mailing list
> textmate-plugins at lists.macromates.com
> http://lists.macromates.com/listinfo/textmate-plugins
More information about the textmate-plugins
mailing list