TextMate::JumpTo - Tell TextMate to jump to a particular file, line


TextMate-JumpTo documentation  | view source Contained in the TextMate-JumpTo distribution.

Index


NAME

Top

TextMate::JumpTo - Tell TextMate to jump to a particular file, line

VERSION

Top

This document describes TextMate::JumpTo version 0.07

SYNOPSIS

Top

    use TextMate::JumpTo qw(jumpto tm_location);

    jumpto( file => 'mysrc.pl', line => 123 );

    my $textmate_link = tm_location( file => 'foo.t', line => 12 );

DESCRIPTION

Top

On Mac OS The TextMate editor handles urls of the form

    txmt://open?url=file://somefile.pl&line=100

which cause it to jump to the file, line and column specified by the arguments. This module is a simple wrapper which uses the Mac OS 'open' command to send TextMate to the specified location.

I use it in my ~/.perldb to have TextMate track the current debugger position. Here's what it looks like:

    $ cat ~/.perldb
    use TextMate::JumpTo qw(jumpto);
    use File::Spec;

    sub afterinit {
        $trace |= 4;    # Enable watchfunction

        # Needed to work out where filenames are relative to
        chomp( $base_dir = `pwd` );

        $option{animate} = 0;
        push @options, 'animate';
    }

    sub watchfunction {
        my ( $package, $file, $line ) = @_;
        return unless $DB::single || $option{animate};
        local $trace = 0;
        if ( $file =~ /^\(eval\s+\d+\)\[(.+?):(\d+)\]/ ) {
            $file = $1;
            $line += $2 - 1;
        }
        $file = File::Spec->rel2abs( $file, $base_dir );
        jumpto( file => $file, line => $line, bg => 1 );
        return 1;
    }

INTERFACE

Top

jumpto

Instruct TextMate to jump to the specified file, line and column. The arguments are a list of key, value pairs:

    jumpto( file => 'splendid.pl', line => 12, column => 3 );

Possible arguments are:

file

The path to the file to go to.

line

The (one based) line number to go to.

column

The (one based) column to go to.

bg

True to leave TextMate in the background. By default a call to jumpto will bring TextMate to the foreground.

tm_location

Get a URL using the txmt: scheme that jumps to the specified location. Arguments as for jumpto with the exeception of the bg switch which makes no sense in this context.

    my $loc = tm_location( file => 'humbile.pm', line => 42 );

CONFIGURATION AND ENVIRONMENT

Top

TextMate::JumpTo requires no configuration files or environment variables.

DEPENDENCIES

Top

None.

INCOMPATIBILITIES

Top

None reported.

BUGS AND LIMITATIONS

Top

No bugs have been reported.

Please report any bugs or feature requests to bug-textmate-jumpto@rt.cpan.org, or through the web interface at http://rt.cpan.org.

AUTHOR

Top

Andy Armstrong <andy@hexten.net>

LICENCE AND COPYRIGHT

Top


TextMate-JumpTo documentation  | view source Contained in the TextMate-JumpTo distribution.