NAME

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

VERSION

This document describes TextMate::JumpTo version 0.02

SYNOPSIS

  use TextMate::JumpTo qw(jumpto);
  
  jumpto( file => 'mysrc.pl', line => 123 );

DESCRIPTION

On Mac OS The TextMate editor handles urls of the form

txmt://open?«arguments»

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

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

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

sub watchfunction {
    my ( $package, $file, $line ) = @_;
    $file = File::Spec->rel2abs( $file, $base_dir );
    jumpto( file => $file, line => $line, bg => 1 )
      if substr( $file, 0, length( $base_dir ) ) eq $base_dir;
}

INTERFACE

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.

CONFIGURATION AND ENVIRONMENT

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

DEPENDENCIES

None.

INCOMPATIBILITIES

None reported.

BUGS AND LIMITATIONS

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

Andy Armstrong <andy@hexten.net>

LICENCE AND COPYRIGHT

Copyright (c) 2008, Andy Armstrong <andy@hexten.net>.

This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic.

1 POD Error

The following errors were encountered while parsing the POD:

Around line 35:

Non-ASCII character seen before =encoding in 'txmt://open?«arguments»'. Assuming UTF-8