[TxMt Plugins] Re: Redefining Word Characters via OakWordCharacters
Bastien Dejean
fuyumugen at free.fr
Wed May 26 19:39:34 UTC 2010
Le 26 mai 2010 à 17:26, Allan Odgaard a écrit :
> 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.
Isn't the ‘TM_CURRENT_WORD’ variable built using ‘isWordCharacter’ ?
Could, at least, the autocompletion work “well” ?
> 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.
Seems quite powerful.
> Also don’t know if this will suffice for your lisp bundle
It might if it's properly linked to autocompletion.
> as I didn’t understand if ‘char=/’ was one unit or it means something else?
‘char/=’ is the name of a Common Lisp function.
The following characters are authorized in function names: +-*/<=>
More information about the textmate-plugins
mailing list