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

Allan Odgaard mailinglist at textmate.org
Fri Aug 22 07:21:51 UTC 2014


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?

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).


More information about the textmate mailing list