Hello, I’m working on textmate 2 command that will process data from a file and insert some some information into the activate textmate document I’ve got the bulk of the job working pretty well except I’d like to ensure the data is allows added to the top of the file. Can anyone tell me how to ensure the cursor is at the top of the document before I insert my data?
Thanks for any help Gary
You can use the mate CLI;
mate --line 1:1 path/to/file.ext
Koen
On Feb 10 2016, at 5:59 pm, Gary Ash <gary.ash@icloud.com> wrote:
Hello,
I’m working on textmate 2 command that will process data from a file and insert some some information into the activate textmate document I’ve got the bulk of the job working pretty well except I’d like to ensure the data is allows added to the top of the file. Can anyone tell me how to ensure the cursor is at the top of the document before I insert my data?
Thanks for any help
Gary
textmate mailing list textmate@lists.macromates.com http://lists.macromates.com/listinfo/textmate
Or do you mean you're working on a bundle and want to move the cursor in file from there?
On Feb 10 2016, at 5:59 pm, Gary Ash <gary.ash@icloud.com> wrote:
Hello,
I’m working on textmate 2 command that will process data from a file and insert some some information into the activate textmate document I’ve got the bulk of the job working pretty well except I’d like to ensure the data is allows added to the top of the file. Can anyone tell me how to ensure the cursor is at the top of the document before I insert my data?
Thanks for any help
Gary
textmate mailing list textmate@lists.macromates.com http://lists.macromates.com/listinfo/textmate
In the "Bundle Support" bundle in Support/shared/lib/textmate.rb there's a go_to function, which uses the txmt:// protocol for the current file, or when a path is supplied it uses the mate cli.
This might get you somewhere :)
Koen
On Feb 10 2016, at 5:59 pm, Gary Ash <gary.ash@icloud.com> wrote:
Hello,
I’m working on textmate 2 command that will process data from a file and insert some some information into the activate textmate document I’ve got the bulk of the job working pretty well except I’d like to ensure the data is allows added to the top of the file. Can anyone tell me how to ensure the cursor is at the top of the document before I insert my data?
Thanks for any help
Gary
textmate mailing list textmate@lists.macromates.com http://lists.macromates.com/listinfo/textmate
This isn't relevant to the original question
But if you have a bundle which outputs to TextMates "HTML window", you can also embed txmt://open/?url=file://[YOUR PATH HERE]&line=0 style links which can then act as document bookmarks
This is a really useful feature :-)
On 10 February 2016 at 22:56, Koen Punt koen@koenpunt.nl wrote:
In the "Bundle Support" bundle in Support/shared/lib/textmate.rb there's a go_to function, which uses the txmt:// protocol for the current file, or when a path is supplied it uses the mate cli.
This might get you somewhere :)
Koen
On Feb 10 2016, at 5:59 pm, Gary Ash gary.ash@icloud.com wrote:
Hello, I’m working on textmate 2 command that will process data from a file and insert some some information into the activate textmate document I’ve got the bulk of the job working pretty well except I’d like to ensure the data is allows added to the top of the file. Can anyone tell me how to ensure the cursor is at the top of the document before I insert my data?
Thanks for any help Gary
textmate mailing list textmate@lists.macromates.com http://lists.macromates.com/listinfo/textmate
textmate mailing list textmate@lists.macromates.com http://lists.macromates.com/listinfo/textmate
On 11 Feb 2016, at 5:56, Koen Punt wrote:
In the "Bundle Support" bundle in Support/shared/lib/textmate.rb there's a go_to function, which uses the txmt:// protocol for the current file, or when a path is supplied it uses the mate cli.
Just for the records, calling "$TM_MATE" with e.g. a --line argument w/o a file path will work on current file even when that file is untitled.
This is a “new” feature (2.0) and the go_to function hasn’t been updated to take advantage of this, thus it still falls back on txmt: for untitled files, but using "$TM_MATE" is more robust since a few other applications can claim the txmt: URL scheme.
Also, the path to the mate shell command is exposed to bundle items via the TM_MATE environment variable, so going via a shell interpreter it can be reached with: "$TM_MATE".
Just for the records, calling "$TM_MATE" with e.g. a --line argument w/o a file path will work on current file even when that file is untitled.
Is the “$TM_MATE” supposed to be accessible as an env var to scripts outside of Textmate bundles? The way I read this thread is that it was, but I get nothing when opening a new shell and running “echo $TM_MATE”. I have the shell support installed and have `export EDITOR="/usr/local/bin/mate -w”` in my .bash_profile.
Ryan
On Fri, Feb 12, 2016 at 4:40 AM, Allan Odgaard mailinglist@textmate.org wrote:
On 11 Feb 2016, at 5:56, Koen Punt wrote:
In the "Bundle Support" bundle in Support/shared/lib/textmate.rb there's a go_to function, which uses the txmt:// protocol for the current file, or when a path is supplied it uses the mate cli.
Just for the records, calling "$TM_MATE" with e.g. a --line argument w/o a file path will work on current file even when that file is untitled.
This is a “new” feature (2.0) and the go_to function hasn’t been updated to take advantage of this, thus it still falls back on txmt: for untitled files, but using "$TM_MATE" is more robust since a few other applications can claim the txmt: URL scheme.
Also, the path to the mate shell command is exposed to bundle items via the TM_MATE environment variable, so going via a shell interpreter it can be reached with: "$TM_MATE".
textmate mailing list textmate@lists.macromates.com http://lists.macromates.com/listinfo/textmate
On 13 Feb 2016, at 2:09, Ryan Fitzer wrote:
Is the “$TM_MATE” supposed to be accessible as an env var to scripts outside of Textmate bundles?
No, TextMate has no control over your global OS X environment, only the environment setup for things launched from within TextMate.