[TxMt Plugins] Re: Redefining Word Characters via OakWordCharacters

Allan Odgaard mailinglist at textmate.org
Wed May 26 15:26:43 UTC 2010


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.

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?





More information about the textmate-plugins mailing list