[TxMt] Re: Where do I update the definition of a word?

Justin Catterall 100621.1 at masonsmusic.co.uk
Tue Sep 2 11:38:06 UTC 2014


On 22 Aug 2014, at 08:21, Allan Odgaard <mailinglist at textmate.org> wrote:

> On 20 Aug 2014, at 22:32, Pedro Melo wrote:
> 
>> using the Perl gramar, if I have the cursor on a package name, like
>> Time::Mo|ment,  (| is the cursor) and I try to get help, it should try to
>> get help on Time::Moment but right now it only uses Moment.
>> 
>> I had this problem with TM1 also but I fixed it by including : in the
>> definition of the "word". I don't know if this is still the way to do it on
>> TM2 or if there is a better way.
> 
> There is definitely a better way, since changing word characters would affect word movement, buffer completion, and other things that rely on word definitions.
> 
> Looking at the command this is what it does:
> 
> 	word=${TM_SELECTED_TEXT:-$TM_CURRENT_WORD}
> 
> A quick fix is to change that line to the following:
> 
> 	word=$(ruby18 -r"$TM_SUPPORT_PATH/lib/current_word" -e"puts Word.current_word(':A-Za-z')")
> 
> This calls the `current_word` function from the bundle support bundle. This function looks at the `TM_CURRENT_LINE` and `TM_LINE_INDEX` variables and then extracts the word surrounding the caret based on the allowed characters (passed as its argument).
> 
> Can you tell me if the above character range would be correct for perl?

(':_A-Za-z0-9')

Module names may contain digits.


> Also, how do I install perl documentation? For me, perldoc reports “no documentation” for my tests (though the command suppresses that, so it’s effectively a no-op, another thing that I’d like to get fixed).

Documentation should be installed automatically with each module. 

I would do some testing but I don't know where "word=${TM_SELECTED_TEXT:-$TM_CURRENT_WORD}" is to test your quick fix.


-- 
Justin C, by the sea.



More information about the textmate mailing list