[TxMt] Re: Re: get last 3 words

Christoph Koehler christoph.koehler at gmail.com
Wed Jun 20 17:35:04 UTC 2007


In article
<alpine.OSX.0.99.0706201013560.28830 at marimac.arbor.net>Steve King
<steve at narbat.com> wrote:

>  On Wed, 20 Jun 2007, Hans-Joerg Bibiko wrote:
>  
>>   Please note, if you change MYCOMMAND the macro won't notice your
>> changes  because the entire code is saved within this macro. You
>> have to rerecord  your macro.

>  The way I handle this is to store all my commands in an external
> file. Each command in TM then just includes that file and makes a
> single subroutine call.  This way I can change the behavior of my
> commands without having to dink around with changing the macros which
> use it.
>  
>  For instance, I have a command set up to show all the Mac-specific
> key symbols as an HTML window.  The command entry in TM's bundle
> editor looks like:
>  
>       #! /usr/bin/perl
>       require "$ENV{TM_BUNDLE_PATH}/tm_lib.pl";
>       print key_symbols();
>  
>  The code for the key_symbols() function is in my bundle directory in
>  <~/Library/Application
> Support/TextMate/Bundles/sking.tmbundle/tm_lib.pl>. (The 'require'
> statement is essentially Perl's version of '#include'.)
>  When I want to change the command's behavior (say, to add a key I'd
> forgotten) I just edit that external file. No need to change the
> command at all in the bundle editor.  If I'd included the command in
> any macros, they'd all automatically pick up the changes without
> having to be individually modified.
>  
>  Another benefit of storing the commands as an external library is
> that you edit them in the main TM window, not the bundle editor. This
> means you get all the nifty language features (syntax highlighting,
> etc.) that are the reason you use TextMate in the first place.
>  
>  I find this technique of using an external library file so handy
> that I code all my TM commands (except trivial one-liners) this way.

Thanks guys! Very helpful! I will play with that!

Christoph


-- 

I'm trying a new usenet client for Mac, Nemo OS X.
You can download it at http://www.malcom-mac.com/nemo





More information about the textmate mailing list