Howtos

Main.Howtos History

Hide minor edits - Show changes to output

October 24, 2012, at 01:55 UTC by lewis -
Changed line 778 from:
You can now edit textareas by right clicking and choosing MozEx ->Edit textarea. The text will open up in TextMate which you can then edit. When you have finished and saved the file, you just need save the file or, click in the textarea for the contents to update with the changes you made in TextMate.
to:
You can now edit textareas by right clicking and choosing MozEx ->Edit textarea. The text will open up in TextMate which you can then edit. When you have finished and saved the file, you just need save the file or, click in the textarea for the contents to update with the changes you made in TextMate [[http://sz-sfdz.com/|video game parts]].
September 11, 2012, at 13:46 UTC by Jeroenh - remove spam
Deleted lines 62-63:
* [[http://www.yourminskapartment.com | Minsk Apartments]]
* [[http://www.repairpartstock.com/products-xx.asp?id=830 | KES-410A]]
August 03, 2012, at 08:57 UTC by AnonymousCoward - *
Added line 64:
* [[http://www.repairpartstock.com/products-xx.asp?id=830 | KES-410A]]
June 12, 2012, at 07:42 UTC by jwoods -
Changed line 63 from:
* [[Minsk Apartments | http://www.yourminskapartment.com/]])
to:
* [[http://www.yourminskapartment.com | Minsk Apartments]]
June 12, 2012, at 07:40 UTC by jwoods -
Changed line 63 from:
* [Minsk Apartments](http://www.yourminskapartment.com/)
to:
* [[Minsk Apartments | http://www.yourminskapartment.com/]])
June 12, 2012, at 07:39 UTC by jwoods -
June 12, 2012, at 07:39 UTC by jwoods -
Changed line 63 from:
to:
* [Minsk Apartments](http://www.yourminskapartment.com/)
October 10, 2011, at 15:36 UTC by Claudio Floreani -
Changed line 725 from:
- Input: Current Word
to:
- Input: Selected Text OR Word
October 10, 2011, at 15:33 UTC by Claudio Floreani - Formatting fix
Changed line 726 from:
- Command: #!/bin/bash
to:
- Command: [@ #!/bin/bash
Changed line 731 from:
find "$TM_FILEPATH" "$SEARCHPATH" -type f -name '*.rb' -exec sed -En "/$STARTPATTERN/,/$ENDPATTERN/p" {} \; |sed -E "/$ENDPATTERN/q"
to:
find "$TM_FILEPATH" "$SEARCHPATH" -type f -name '*.rb' -exec sed -En "/$STARTPATTERN/,/$ENDPATTERN/p" {} \; |sed -E "/$ENDPATTERN/q" @]
October 10, 2011, at 15:32 UTC by Claudio Floreani - fix formatting
Changed lines 726-727 from:
- Command:
<pre>#!/bin/bash
to:
- Command: #!/bin/bash
Deleted line 731:
</PRE>
October 10, 2011, at 15:30 UTC by Claudio Floreani - Added an improved way to Lookup for a method or class definition in Ruby
Added line 45:
** [[#RLookupDef | Lookup class or method definition(2)]]
Changed lines 724-736 from:
to:
!! Lookup class or method definition (2) [[#RLookupDef]]
- Input: Current Word
- Command:
<pre>#!/bin/bash
SEARCHPATH=$(test -x "$TM_PROJECT_DIRECTORY" && echo "$TM_PROJECT_DIRECTORY" || echo $(dirname "$TM_FILEPATH") )
STARTPATTERN="^([[:space:]]|;)*(def|class)([[:space:]]|;)+$TM_CURRENT_WORD([^A-Za-z0-9_].*)*$"
ENDPATTERN="^([[:space:]]|;)*end([[:space:]]|;)*"
(egrep -ns "$STARTPATTERN" "$TM_FILEPATH" || egrep -nsR "$STARTPATTERN" --exclude="*.svn*" "$SEARCHPATH") |cut -d: -f-2
find "$TM_FILEPATH" "$SEARCHPATH" -type f -name '*.rb' -exec sed -En "/$STARTPATTERN/,/$ENDPATTERN/p" {} \; |sed -E "/$ENDPATTERN/q"
</PRE>
- Output: Show as tooltip
- Activation: Key Equivalent: CTRL+]
Check this post: [[http://claudiofloreani.blogspot.com/2011/10/add-shortcut-to-textmate-to-lookup.html]]
February 13, 2011, at 19:18 UTC by Elia Schito - Added TimeTap in the Time Tracking section.
Added lines 331-332:
!! Time Tracking
Added lines 335-339:

!!! TimeTap
[[TimeTap: the unobtrusive time tracking for TextMate -> http://github.com/elia/timetap#readme]]
It stays in background and presents your stats in a useful web interface.
Install it from [[Rubygems.org -> http://rubygems.org/gems/time_tap]].
November 08, 2010, at 02:50 UTC by Anonymous Bosch - Fix link
Changed lines 61-62 from:
* [[#Get TM2 Now! | How To Cut Short the Wait for TextMate 2]]
to:
* [[#GetTM2Now | How To Cut Short the Wait for TextMate 2]]
Changed line 923 from:
[[#Get TM2 Now]]
to:
[[#GetTM2Now]]
November 08, 2010, at 02:48 UTC by Anonymous Bosch - Found this in an old Comp Sci book, thought it might be useful!
Changed lines 61-62 from:
to:
* [[#Get TM2 Now! | How To Cut Short the Wait for TextMate 2]]
Changed lines 921-939 from:
This can be done by searching for a regular expression where "\b" (word separator) is prepended and appended to the searched word. i.e searching for "\bMessage\b" instead of "Message".
to:
This can be done by searching for a regular expression where "\b" (word separator) is prepended and appended to the searched word. i.e searching for "\bMessage\b" instead of "Message".

[[#Get TM2 Now]]
!!How To Cut Short the Wait for TextMate 2

Are you fed up with waiting for TextMate 2?\\
Would you like to run the mythical editor right now?

Here's how to do it on Mac OS X. Just follow these three easy steps:

1. Design and code a clone of TextMate. Be careful! Your app needs to run as well as the present one and include all announced new features to really be called TM2.

2. Put your code in a directory containing TextMate.xcodeproj

3. Compile using XCode and copy the result to /Applications.

It's as simple as that. And remember, Beethoven wrote his second symphony 6 years after his first.

-O.B.C Hashfunk's Featherweight Folio of Worthwhile Workarounds and Decorative Stitches
September 11, 2010, at 23:06 UTC by MSpreij -
Changed lines 431-433 from:
input: entire document
output: insert as text
-------------------
to:
Input: Entire Document
Output: Insert as Text
Scope: source.php, source.js

Command:
September 11, 2010, at 23:04 UTC by MSpreij -
Changed lines 428-430 from:
Collects all defined functions (name+params) in the document and inserts a commented out list of them at caret's position, right padding with spaces lined up to 4 columns after the longest name-(params).

%block bgcolor=#dfd border='1px solid black' padding=5px% [=
to:
Collects all defined functions (name+params) in the document and inserts a commented-out list of them at caret's position, right padded with spaces lined up to 5 columns after the longest name+(params).

%block bgcolor=#dfd border='1px solid black' padding=5px% [=
Changed line 450 from:
=]
to:
=]
September 11, 2010, at 22:55 UTC by MSpreij - Added PHP: 'List Functions in Page'
September 11, 2010, at 22:54 UTC by MSpreij - Added PHP: 'List Functions in Page'
Changed lines 22-23 from:
to:
** [[#PHPListPageFunctions | List Functions in Page]]
Added lines 425-450:

!!! List Functions in Page - ''M Spreij'' [[#PHPListPageFunctions]]

Collects all defined functions (name+params) in the document and inserts a commented out list of them at caret's position, right padding with spaces lined up to 4 columns after the longest name-(params).

%block bgcolor=#dfd border='1px solid black' padding=5px% [=
input: entire document
output: insert as text
-------------------
#!/usr/bin/php
<?php

while ($fetch = fread(STDIN, 1000)) $data .= $fetch;
if (! $data) exit;

if (preg_match_all("/function (.*) {/", $data, $matches)) {
unset($matches[0]);
$matches = $matches[1];
echo "/** -- Functions -------------------------\n * \n";
$postfix = max(array_map('strlen', $matches)) + 7;
foreach($matches as $match) {
echo str_pad(' * '. $match, $postfix) . "\n";
}
echo " * \n * \n**/\n";
}
=]
September 11, 2010, at 22:46 UTC by MSpreij - Cleaned up my own older code at 'Change Leading Spaces To Tabs'
Deleted lines 287-291:
$fetch = fread(STDIN, 100);
if (! strlen($fetch)) {
return;
}
Changed lines 291-296 from:
$data = $fetch;

while (strlen($fetch)) {
$fetch = fread(STDIN, 1000);
$data .= $fetch;
}
to:
while ($fetch = fread(STDIN, 1000)) $data .= $fetch;
if (! $data) exit;
September 11, 2010, at 22:41 UTC by MSpreij - Added 'Run PHP, Show as HTML' command
Changed line 414 from:
!!! Run PHP, show as HTML - ''M Spreij'' [[#PHPRunShowHTML_2]]
to:
!!! Run PHP, show as HTML - ''M Spreij'' [[#PHPRunShowHTML]]
September 11, 2010, at 22:40 UTC by MSpreij - Added 'Run PHP, Show as HTML' command
Added lines 21-22:
** [[#PHPRunShowHTML | Run PHP, Show as HTML]]
Changed lines 399-400 from:
!!! PHP Project Functions - "Dion Almaer" [[#PHPProjectFunctions]]
to:
!!! PHP Project Functions - ''Dion Almaer'' [[#PHPProjectFunctions]]
Added lines 412-431:
=]

!!! Run PHP, show as HTML - ''M Spreij'' [[#PHPRunShowHTML_2]]

Runs the PHP code in the [unsaved] HTML document, then shows the result rendered as HTML.

%block bgcolor=#dfd border='1px solid black' padding=5px% [=
Input: Entire Document
Output: Show as HTML
Scope selector: text.html, source.php

Command:
#!/usr/bin/php
<?php
$data = '';
while ($tmp = fread(STDIN, 1000)) $data .= $tmp;
if (! $data) return false;

$data = "?>$data<?php";
eval($data);
July 05, 2010, at 19:29 UTC by pdx05858pdxedu - Can Textmate alphabetize word lists?
July 05, 2010, at 19:28 UTC by pdx05858pdxedu - Can Textmate alphabetize word lists?
March 27, 2010, at 23:43 UTC by Yair Chuchem - Description of how to do whole word search
Changed lines 57-58 from:
to:
* [[#WholeWordSearch | Whole word search]]
Changed lines 871-878 from:
LaTeX [[#LaTeX]]
to:
LaTeX [[#LaTeX]]

[[#WholeWordSearch]]
!!Whole word search

Whole word search meaning that when searching for "Message" you will not find "sendMessages" too, just occurrences where "Message" is the whole word.

This can be done by searching for a regular expression where "\b" (word separator) is prepended and appended to the searched word. i.e searching for "\bMessage\b" instead of "Message".
March 22, 2010, at 23:15 UTC by Sky - Had to use bit.ly for link to wikipedia because Date_(Unix) breaks this URL
Changed line 348 from:
To format your own dates (such as "10/7/2008"), use the formatting codes for the Unix date command ([[http://en.wikipedia.org/wiki/Date_(Unix)#Setting_the_date|see Wikipedia]])
to:
To format your own dates (such as "10/7/2008"), use the formatting codes for the Unix date command. See [[Wikipedia -> http://bit.ly/9IkYaj]].
March 18, 2010, at 17:34 UTC by Jesse Scott - Added link to alternative implementation of backup on save howto.
Added lines 172-173:

([[http://gist.github.com/336600 | Commands to do the same thing without invoking PHP or Perl]].)
February 12, 2010, at 22:15 UTC by Ross - Adjusted FHTML link to Snipplr
Changed lines 596-598 from:
(I give it the key command: Command-Option-Shift-F to match BBEdit's "reformat HTML code" command.)

[[http://home.reyman.us/resources/FHTML-TextMate.txt | FHTML-TextMate.txt ]]
to:
(I give it the key command: Command-Option-Shift-F to match BBEdit's "reformat HTML code" command.) Note the new link to Snipplr.

[[http://snipplr.com/view/28256/fhtml-for-textmate/ ]]
November 17, 2009, at 08:17 UTC by x -
Deleted line 92:
import string
Changed line 105 from:
output_str = string.join(result, " + ")
to:
output_str = " + ".join(result)
October 21, 2009, at 09:14 UTC by bob -
Changed line 643 from:
## Run preg_replace_callback to take variable declarations
to:
## Run preg_replace to take variable declarations
Changed line 646 from:
php -r 'echo preg_replace("|(\w+) (\w+) (\w+):(\w+);|e", "\"\npublic function get\".ucfirst(\$3).\"():\".\$4.\" {\n\treturn \".\$3.\"; \n}\n\n\".\$1.\" function set\".ucfirst(\$3).\"(\".\$3.\":\".\$4.\"):Void {\n\tthis.\".\$3.\" = \".\$3.\";\n}\"", file_get_contents("/dev/stdin") );';
to:
php -r 'echo preg_replace("|(\w+) (\w+) (\w+):(\w+);|e", '"\npublic function get".ucfirst($3)."():$4 {\n\treturn $3; \n}\n\n$1 function set".ucfirst($3)."($3:$4):Void {\n\tthis.$3 = $3;\n}"', file_get_contents("/dev/stdin") );';
October 19, 2009, at 07:48 UTC by bob - replaced preg_replace_callback with simpler preg_replace
Changed line 646 from:
php -r 'echo preg_replace_callback("|(\w+) (\w+) (\w+):(\w+);|", create_function("\$matches","return \"\npublic function get\".ucfirst(\$matches[3]).\"():\".\$matches[4].\" {\n\treturn \".\$matches[3].\"; \n}\n\n\".\$matches[1].\" function set\".ucfirst(\$matches[3]).\"(\".\$matches[3].\":\".\$matches[4].\"):Void {\n\tthis.\".\$matches[3].\" = \".\$matches[3].\";\n}\";"), file_get_contents("/dev/stdin") );';
to:
php -r 'echo preg_replace("|(\w+) (\w+) (\w+):(\w+);|e", "\"\npublic function get\".ucfirst(\$3).\"():\".\$4.\" {\n\treturn \".\$3.\"; \n}\n\n\".\$1.\" function set\".ucfirst(\$3).\"(\".\$3.\":\".\$4.\"):Void {\n\tthis.\".\$3.\" = \".\$3.\";\n}\"", file_get_contents("/dev/stdin") );';
July 21, 2009, at 14:57 UTC by Joshua Jabbour -
Changed lines 512-518 from:
This works great for Transmit also, just replace "Interarchy" with "Transmit". -- natebeaty
to:
!!! Applescript to trigger Transmit "DockSend" with command - ''Provided by natebeaty'' [[#OpenFile]]

This line of code sends the active TextMate file to Transmit. If the file is on a path specified in a DockSend-enabled favorite, the file will be automatically uploaded to the server.

%block bgcolor=#dfd border='1px solid black' padding=5px% [=
osascript -e 'tell app "Transmit" to open POSIX file "'"$TM_FILEPATH"'"'
=]
July 14, 2009, at 17:00 UTC by Ikuta Lin - Python Textmate-Ropy AutoCompletion
July 14, 2009, at 17:00 UTC by Ikuta Lin - Python Textmate-Ropy AutoCompletion
Added lines 42-43:
* [[#Python | Python]]
** [[#Textmate-Ropy | Textmate-Ropy AutoCompletion]]
Added lines 665-677:


!! Python [[#Python]]

!! Textmate-Ropy AutoCompletion - ''Ikuta Lin''[[#Textmate-Ropy]]
- Install rope
- hg clone http://bitbucket.org/agr/rope/
- sudo easy_install rope
- Install Textmate-Ropy
- svn checkout http://textmate-ropy.googlecode.com/svn/trunk/ textmate-ropy-read-only
- C-P - Autocompletion
- C-] - Search class or methond defination
Added line 863:
LaTeX [[#LaTeX]]
March 28, 2009, at 13:16 UTC by Masonna -
Added lines 54-55:
* [[#TimedAutoSave | How to use timed autosave with Textmate]]
Changed lines 824-848 from:
Steve King adds: ''You can do this globally instead of project-by-project by opening the Preferences window and going to "Advanced", "Folder References".''
to:
Steve King adds: ''You can do this globally instead of project-by-project by opening the Preferences window and going to "Advanced", "Folder References".''

[[#TimedAutoSave]]
!!How to use timed autosave with Textmate

Textmate doesn't include timed autosave. I thought that feature would simplify my workflow with typing LaTeX documents.

In conjunction with latexmk, autosaving allows almost for an WSIWYG environment (More details about the continuous monitoring ability of latexmk: http://jon.smajda.com/blog/2008/03/08/latexmk/). You avoid the need save the document yourself and by that invoke latexmk.

Make autosaving work with Textmate:

1. Get the freeware Eversave from http://www.tool-forcesw.com/eversave/ and install it

2. In preference of Eversave: Under "When should Eversave save:" pick "Time-controlled"

3. Under "Automatically save these applications" pick Textmate

4. Under "Timer" set how fast you want it to be saved (for the LaTeX application I mentioned earlier, it should be <5s)

5. CRUCIAL: under "Please choose a save method" pick "Save by simulating save shortcut (more compatible)" as the other method does NOT work with Textmate (it will invoke the "Save as" command instead of the "Save" command, which is useless for our (most) purposes).

That's it.


October 07, 2008, at 21:07 UTC by CC - fixing dumb linking mistake
Changed line 15 from:
** [[#TemplateAuthoringDates | Formatting Dates in Templates
to:
** [[#TemplateAuthoringDates | Formatting Dates in Templates ]]
October 07, 2008, at 21:06 UTC by CC - Info about authoring templates: formatting dates
Changed lines 12-16 from:
* [[#TimeTracking | Time tracking]]
to:
** [[#TimeTracking | Time tracking]]

* [[#TemplateAuthoring | Template Authoring]]
** [[#TemplateAuthoringDates | Formatting Dates in Templates
Added lines 332-349:

!! Template Authoring [[#TemplateAuthoring]]

!!! Formatting Dates in Templates [[#TemplateAuthoringDates]]

Default templates contain this code:
[@
TM_DATE=`date +%Y-%m-%d`
@]
which produces a date like "2008-10-07"

To format your own dates (such as "10/7/2008"), use the formatting codes for the Unix date command ([[http://en.wikipedia.org/wiki/Date_(Unix)#Setting_the_date|see Wikipedia]])

To put spaces in your formatting code (such as in "7 October 2008"), you need to wrap your formatting codes in double quotes:
[@
TM_DATE=`date +"%e %B %Y"`
@]
To the uninitiated (such as myself) that doesn't look like it should work, but it saves the day.
August 19, 2008, at 15:33 UTC by jackdanger - reverting broken change
Changed line 210 from:
'''Save:''' Current File \\
to:
'''Save:''' Nothing \\
Added lines 213-244:
'''Std In:''' Entire Document \\
'''Std Out:''' Replace Document \\
'''Activation:''' Key Equivalent Cmd-S
%%

The command above only strips whitespace. ie the file never gets saved. Following script should strip the whitespace and then save (Note: requires rb-appscript gem)

%block bgcolor=#dfd border='1px solid black' padding=5px% \
'''Save:''' Nothing \\
'''Command(s):''' \\
%%

%block bgcolor=#dfd border='1px solid black' padding=5px% \
[@require 'rubygems'
require 'appscript'
class TextMate
include Appscript
def self.save_current
doc = Application.by_name('TextMate').documents[0]
if doc.modified.get
doc_alias = MacTypes::Alias.path(doc.path.get)
doc.save(:in => doc_alias)
end
end
end

doc_text = STDIN.read
puts doc_text.gsub(/[\t ]+$/, '')

TextMate.save_current@]

%block bgcolor=#dfd border='1px solid black' padding=5px% \
August 19, 2008, at 15:27 UTC by jackdanger - simplifying the trailing whitespace example.
Changed line 210 from:
'''Save:''' Nothing \\
to:
'''Save:''' Current File \\
Deleted lines 212-243:
'''Std In:''' Entire Document \\
'''Std Out:''' Replace Document \\
'''Activation:''' Key Equivalent Cmd-S
%%

The command above only strips whitespace. ie the file never gets saved. Following script should strip the whitespace and then save (Note: requires rb-appscript gem)

%block bgcolor=#dfd border='1px solid black' padding=5px% \
'''Save:''' Nothing \\
'''Command(s):''' \\
%%

%block bgcolor=#dfd border='1px solid black' padding=5px% \
[@require 'rubygems'
require 'appscript'
class TextMate
include Appscript
def self.save_current
doc = Application.by_name('TextMate').documents[0]
if doc.modified.get
doc_alias = MacTypes::Alias.path(doc.path.get)
doc.save(:in => doc_alias)
end
end
end

doc_text = STDIN.read
puts doc_text.gsub(/[\t ]+$/, '')

TextMate.save_current@]

%block bgcolor=#dfd border='1px solid black' padding=5px% \
June 24, 2008, at 18:53 UTC by Toby Boyd - Alternative Firefox Integration
Changed lines 673-678 from:
to:
!! Addendum to the addendum (works in FF2, FF3)

# Go to https://addons.mozilla.org/en-US/firefox/addon/4125 and install the current version of It's All Text!

# Once you've restarted Firefox, go to the prefs for It's All Text! and set the editor path to "/Applications/TextMate.app/Contents/Resources/mate".
Added lines 680-681:

Unclear - this would make temporary changes to the currently-loaded page's style? How sweeping do such edits need to be (that is, do they require TextMate)?
May 16, 2008, at 14:50 UTC by Adam Salter - Added strip whitespace option that saves document
Added lines 217-249:

The command above only strips whitespace. ie the file never gets saved. Following script should strip the whitespace and then save (Note: requires rb-appscript gem)

%block bgcolor=#dfd border='1px solid black' padding=5px% \
'''Save:''' Nothing \\
'''Command(s):''' \\
%%

%block bgcolor=#dfd border='1px solid black' padding=5px% \
[@require 'rubygems'
require 'appscript'
class TextMate
include Appscript
def self.save_current
doc = Application.by_name('TextMate').documents[0]
if doc.modified.get
doc_alias = MacTypes::Alias.path(doc.path.get)
doc.save(:in => doc_alias)
end
end
end

doc_text = STDIN.read
puts doc_text.gsub(/[\t ]+$/, '')

TextMate.save_current@]

%block bgcolor=#dfd border='1px solid black' padding=5px% \
'''Std In:''' Entire Document \\
'''Std Out:''' Replace Document \\
'''Activation:''' Key Equivalent Cmd-S
%%
April 25, 2008, at 21:10 UTC by rictic -
Changed lines 748-749 from:
!!How to exclude files and folders from the Project Drawer]]
to:
!!How to exclude files and folders from the Project Drawer
Changed lines 758-760 from:
Example regex: to hide all compiled java classes (.class files), use this regex as a File Pattern: !\.class$
to:
Example regex: to hide all compiled java classes (.class files), use this regex as a File Pattern: !\.class$

Steve King adds: ''You can do this globally instead of project-by-project by opening the Preferences window and going to "Advanced", "Folder References".''
April 24, 2008, at 17:39 UTC by rictic - Added section "How to exclude files and folders from the Project Drawer"
Added line 49:
* [[#ExcludeProjectDrawer | How to exclude files and folders from the Project Drawer]]
Changed lines 745-758 from:
If you have problems with TextMate and sshfs (more sshfs than TextMate) crashing your computer, turn off the sshfs cache by adding 'cache=no,' to the above command '''before''' 'volname'. Later versions of sshfs can cache file changes for up to 20 seconds, which is often annoying.
to:
If you have problems with TextMate and sshfs (more sshfs than TextMate) crashing your computer, turn off the sshfs cache by adding 'cache=no,' to the above command '''before''' 'volname'. Later versions of sshfs can cache file changes for up to 20 seconds, which is often annoying.

[[#ExcludeProjectDrawer]]
!!How to exclude files and folders from the Project Drawer]]

Textmate naturally doesn't display certain files and folders in the project view. For example, .svn and .git folders, and .pyc files.

1. Select the root folder of your project within the project drawer.

2. Click the 'i' button in the bottom right of the project drawer.

3. There are two text areas for regular expressions which control the files and folders displayed.

Example regex: to hide all compiled java classes (.class files), use this regex as a File Pattern: !\.class$
March 18, 2008, at 15:21 UTC by bibiko -
Changed lines 474-475 from:
!!! osascript, shell script, %red%UTF-8%black% - ''Hans-Jörg Bibiko'' [[#osascriptutf8]]
to:
[[#osascriptutf8]]
!!! osascript, shell script, %red%UTF-8%black% - ''Hans-Jörg Bibiko''
March 18, 2008, at 15:07 UTC by bibiko -
Added line 23:
** [[#osascriptutf8 | osascript, shell script, UTF-8]]
Changed lines 474-475 from:

to:
!!! osascript, shell script, %red%UTF-8%black% - ''Hans-Jörg Bibiko'' [[#osascriptutf8]]

TextMate's internal encoding is UTF-8. This is also true for the Bundle Editor. But, how to deal with UTF-8 encoded text files or variables by writing a shell command in the Bundle Editor if ''osascript'' only expects data encoded in MacRoman?

'''Example:'''
*''Read the UTF-8 encoded content of a file and insert it into an other document window without loosing the focus.''

%block bgcolor=#dfd border='1px solid black' padding=5px% \
'''Before running command:''' Do nothing \\
'''Command(s):''' \\
@@%blue%''# open/activate the target''@@ \\
@@mate ~/target.txt@@ \\
@@ \\
@@%blue%''# read the UTF-8 encode text coming from ~/test.txt''%%@@ \\
@@TXT=$(cat ~/test.txt)@@ \\
@@ \\
@@%blue%''# now comes the trick''@@ \\
@@cat <<-AS | iconv -f UTF-8 -t MACROMAN | osascript --@@ \\
@@tell application "TextMate" to insert "'''$TXT'''"@@ \\
@@tell application "System Events" to keystroke "\`" using (command down)@@ \\
@@AS@@ \\
'''Standard input:''' None \\
'''Standard output:''' Discard
%%

''osascript'' expects AppleScript commands encoded in MacRoman. This is simply done by using ''iconv''.
The actual UTF-8 data stored in '''$TXT''' are passed to ''osascript'' simply by bash shell's variable expansion facility.
March 06, 2008, at 15:52 UTC by Nem Schlecht nemws1gmailcom -
Changed line 716 from:
If you have problems with TextMate crashing, try turning off the sshfs cache by adding 'cache=no,' to the above command '''before''' 'volname'.
to:
If you have problems with TextMate and sshfs (more sshfs than TextMate) crashing your computer, turn off the sshfs cache by adding 'cache=no,' to the above command '''before''' 'volname'. Later versions of sshfs can cache file changes for up to 20 seconds, which is often annoying.
March 06, 2008, at 15:49 UTC by Nem Schlecht nemws1gmailcom -
Changed lines 708-709 from:
sshfs user@servername:/ ~/mnt/servername -oping_diskarb,volname=servername'
to:
sshfs user@servername:/ ~/mnt/servername -o'ping_diskarb,volname=servername'
Added lines 715-716:

If you have problems with TextMate crashing, try turning off the sshfs cache by adding 'cache=no,' to the above command '''before''' 'volname'.
February 21, 2008, at 04:48 UTC by brianwilson -
Changed lines 292-293 from:
You can use *matewatch* to automatically track time spent in documents in Textmate. For more info go [[here -> http://blog.ardes.com/articles/2007/09/14/textmate-user-time-tracking-for-free-matewatch]]
to:
You can use *matewatch* to automatically track time spent in documents in Textmate. For more info go [[here -> http://blog.ardes.com/2007/9/14/os-x-textmate-user-free-time-tracker-matewatch]]
February 12, 2008, at 17:02 UTC by Jon Beebe -
Added lines 533-534:
A new link for AS Dictionary integration: http://www.dirtystylus.com/blog/2007/04/24/enabling-actionscript-help-in-textmate/
December 20, 2007, at 17:06 UTC by Michael Lehmkuhl -
Added line 11:
** [[#QuotedPrintableDecode | Decode a block of quoted-printable text]]
Changed lines 143-144 from:
!!! Automatically backup your file each time you save - ''Michael Lehmkuhl'' [[#BackupOnSave]]
to:
[[#BackupOnSave]]
!!! Automatically backup your file each time you save - ''Michael Lehmkuhl''
Added lines 286-289:
[[#QuotedPrintableDecode]]
!!! Decode a block of quoted-printable text - ''Michael Lehmkuhl''
This command gives you a quick way to decode quoted-printable text, like if you copy it from the source of a multi-part email message, for example. [[download the command -> http://electricpulp.com/blog/2007/12/20/decode-quoted-printable-text-with-this-handy-dandy-textmate-commandy/]]
Changed line 291 from:
to:
!!! matewatch
Changed line 712 from:
umount ~/mnt/servername
to:
umount ~/mnt/servername
November 21, 2007, at 22:00 UTC by Nick Fleisher -
Changed line 37 from:
** [[#BibtexSearches | Automatically capitalize BibTeX search terms]]
to:
** [[#BibtexSearches | Case-insensitive BibTeX search terms]]
Changed lines 559-560 from:
!!! Automatically capitalize BibTeX search terms [[#BibtexSearches]]
One very useful command in the LaTeX bundle is "Citation based on current word/selection" (bound by default to Option-Escape). BibTeX entries, however, typically have all meaningful words capitalized, meaning that in order for "Citation based on current word/selection" to work properly, you must capitalize your search term, as the search functionality uses grep. If you'd like to be able to use this function in a case insensitive way, you can edit the command in the Bundle Editor so that it capitalizes your current word/selection before performing the BibTeX search. Just edit the fifth line in the command: instead of @@phrase = STDIN.read.chomp@@, change it to @@phrase = STDIN.read.capitalize.chomp@@. Now you should be able to use "Citation based on current word/selection" without having to worry about capitalizing your BibTeX search terms.
to:
!!! Case-insensitive BibTeX search terms [[#BibtexSearches]]
One very useful command in the LaTeX bundle is "Citation based on current word/selection" (bound by default to Option-Escape). BibTeX entries, however, typically have all meaningful words capitalized, meaning that in order for "Citation based on current word/selection" to work properly in its default configuration, you must capitalize your search term, as the search functionality uses grep. If you'd like to be able to use this function in a case-insensitive way, there are (at least) two options, each of which involves editing the command in the Bundle Editor. (1) You can make the search case-insensitive by adding a parameter to the grep command: edit the line that begins @@items = items.grep(/#{phrase}/)@@ so that it instead begins @@items = items.grep(/#{phrase}/i)@@. (2) You can have TextMate capitalize your current word/selection before performing the BibTeX search. To do this, edit the fifth line in the command: instead of @@phrase = STDIN.read.chomp@@, change it to @@phrase = STDIN.read.capitalize.chomp@@. Note, though, that this second method will miss any search terms that aren't capitalized in your .bib file, so the first method is probably preferable. Either way, you should now be able to use "Citation based on current word/selection" without having to worry about capitalizing your BibTeX search terms.
October 19, 2007, at 01:59 UTC by Nick Fleisher -
Changed line 37 from:
** [[#BibtexSearches | Case insensitive BibTeX searches]]
to:
** [[#BibtexSearches | Automatically capitalize BibTeX search terms]]
Changed lines 559-560 from:
!!! Case insensitive BibTeX searches [[#BibtexSearches]]
One very useful command in the LaTeX bundle is "Citation based on current word/selection" (bound by default to Option-Escape). BibTeX entries, however, typically have all meaningful words capitalized, meaning that in order for "Citation based on current word/selection" to work properly, you must capitalize your search term, as the search functionality uses grep. If you'd like to be able to use this function in a case insensitive way, you can edit the command in the Bundle Editor so that it capitalizes your current word/selection before performing the BibTeX search. Just edit the fifth line in the command: instead of @@phrase = STDIN.read.chomp@@, change it to @@phrase = STDIN.read.capitalize.chomp@@. Now you should be able to use "Citation based on current word/selection" in a case insensitive way, without having to worry about capitalizing your BibTeX search terms.
to:
!!! Automatically capitalize BibTeX search terms [[#BibtexSearches]]
One very useful command in the LaTeX bundle is "Citation based on current word/selection" (bound by default to Option-Escape). BibTeX entries, however, typically have all meaningful words capitalized, meaning that in order for "Citation based on current word/selection" to work properly, you must capitalize your search term, as the search functionality uses grep. If you'd like to be able to use this function in a case insensitive way, you can edit the command in the Bundle Editor so that it capitalizes your current word/selection before performing the BibTeX search. Just edit the fifth line in the command: instead of @@phrase = STDIN.read.chomp@@, change it to @@phrase = STDIN.read.capitalize.chomp@@. Now you should be able to use "Citation based on current word/selection" without having to worry about capitalizing your BibTeX search terms.
October 18, 2007, at 03:14 UTC by Nick Fleisher -
Added lines 36-37:
* [[#LaTeX | LaTeX]]
** [[#BibtexSearches | Case insensitive BibTeX searches]]
Added lines 557-562:
!! LaTeX [[#LaTeX]]

!!! Case insensitive BibTeX searches [[#BibtexSearches]]
One very useful command in the LaTeX bundle is "Citation based on current word/selection" (bound by default to Option-Escape). BibTeX entries, however, typically have all meaningful words capitalized, meaning that in order for "Citation based on current word/selection" to work properly, you must capitalize your search term, as the search functionality uses grep. If you'd like to be able to use this function in a case insensitive way, you can edit the command in the Bundle Editor so that it capitalizes your current word/selection before performing the BibTeX search. Just edit the fifth line in the command: instead of @@phrase = STDIN.read.chomp@@, change it to @@phrase = STDIN.read.capitalize.chomp@@. Now you should be able to use "Citation based on current word/selection" in a case insensitive way, without having to worry about capitalizing your BibTeX search terms.
--Nick Fleisher
September 14, 2007, at 14:05 UTC by Ian White -
Changed lines 284-286 from:
You can use *matewatch* to automatically track time spent in documents in Textmate. For more info go here:
http://blog.ardes.com/articles/2007/09/14/textmate-user-time-tracking-for-free-matewatch
to:
You can use *matewatch* to automatically track time spent in documents in Textmate. For more info go [[here -> http://blog.ardes.com/articles/2007/09/14/textmate-user-time-tracking-for-free-matewatch]]
September 14, 2007, at 14:03 UTC by Ian White -
Added line 11:
* [[#TimeTracking | Time tracking]]
Added lines 282-286:
[[#TimeTracking]]

You can use *matewatch* to automatically track time spent in documents in Textmate. For more info go here:
http://blog.ardes.com/articles/2007/09/14/textmate-user-time-tracking-for-free-matewatch
September 12, 2007, at 15:14 UTC by Michel Pfirter -
Changed lines 689-693 from:
Now on the commandline on my laptop, I go to any file in ~/mnt/servername/ and do: mate <filename> and I can just add files to a projectdrawer in textmate. Best of all is that you do not need to prepare anything on your server if it is already running ssh.
to:
Now on the commandline on my laptop, I go to any file in ~/mnt/servername/ and do: mate <filename> and I can just add files to a projectdrawer in textmate. Best of all is that you do not need to prepare anything on your server if it is already running ssh.

If you are done, unmount the Volume by clicking on the regular eject icon in Finder or type the following in your Terminal:

umount ~/mnt/servername
May 26, 2007, at 16:42 UTC by ybart -
Changed line 502 from:
@@cat <&0 >/tmp/saf_tmp.html >&1@@ \\
to:
@@tee /tmp/saf_tmp.html@@ \\
May 26, 2007, at 16:34 UTC by ybart -
Added line 26:
** [[#SafariPreview | Preview in Safari]]
Added lines 494-513:
!!! Preview in Safari [[#SafariPreview]] - ''Yvan BARTHÉLEMY''

If you want a JavaScript aware previewer, you probably want to use Safari or Firefox to preview your page rather than the built-in previewer.

First, copy this shell script somewhere on your filesystem

%block bgcolor=#dfd border='1px solid black' padding=5px% \
@@#!/bin/bash --posix@@ \\
@@cat <&0 >/tmp/saf_tmp.html >&1@@ \\
\\
@@osascript -e "tell application \"Safari\" to open location \[="file:///tmp/saf_tmp.html\""=]@@
%%

Of course you might replace Safari with any browser of your choice, and modify this script to allow choosing browser using a command-line argument.

Then, open the TextMate Web Preview,
check the checkbox : Pipe Text trough,

then paste 'sh' followed with the path to your script (e.g. 'sh ~/Documents/script/browser.sh')
March 25, 2007, at 17:21 UTC by Scot Hacker -
Changed lines 476-477 from:
If you're switching to TextMate from BBEdit and you do a lot of HTML content creation, you may be bummed to find that the "wrap selection in open/close tags" bundle item wraps the '''whole''' selection in p, rather than detecting each individual paragraph, as BBEdit does. To make this work as expected, open the Bundle editor. Select the bundle "Wrap each selected Line in Open/Close Tag" and duplicate it. Rename it something like "Wrap paragraphs." Edit the duplicate to use p rather than li. Give it key equivalent (I use Cmd-P, since this is such a common action). -- S Hacker
to:
If you're switching to TextMate from BBEdit and you do a lot of HTML content creation, you may be bummed to find that the "wrap selection in open/close tags" bundle item wraps the '''whole''' selection in p, rather than detecting each individual paragraph, as BBEdit does. To make this work as expected, open the Bundle editor. Select the bundle "Wrap each selected Line in Open/Close Tag" and duplicate it. Rename it something like "Wrap paragraphs." Edit the duplicate to use p rather than li. Give it a key equivalent (I use Cmd-P, since this is such a common action). -- S Hacker
March 25, 2007, at 17:20 UTC by Scot Hacker -
Changed lines 476-477 from:
If you're switching to TextMate from BBEdit and you do a lot of HTML content creation, you may be bummed to find that the "wrap selection in open/close tags" bundle item wraps the '''whole''' selection in p, rather than detecting each individual paragraph, as BBEdit does. To make this work as expected, open the Bundle editor. Select the bundle "Wrap each selected Line in Open/Close Tag" and duplicate it. Edit the duplicate to use p rather than li. Give it key equivalent (I use Cmd-P, since this is such a common action). -- S Hacker
to:
If you're switching to TextMate from BBEdit and you do a lot of HTML content creation, you may be bummed to find that the "wrap selection in open/close tags" bundle item wraps the '''whole''' selection in p, rather than detecting each individual paragraph, as BBEdit does. To make this work as expected, open the Bundle editor. Select the bundle "Wrap each selected Line in Open/Close Tag" and duplicate it. Rename it something like "Wrap paragraphs." Edit the duplicate to use p rather than li. Give it key equivalent (I use Cmd-P, since this is such a common action). -- S Hacker
March 25, 2007, at 17:14 UTC by Scot Hacker -
Added line 23:
** [[#WrapAllP | Wrap All Paragraphs with p]]
Added lines 474-477:

!!! Wrap All Paragraphs with p [[#WrapAllP]]
If you're switching to TextMate from BBEdit and you do a lot of HTML content creation, you may be bummed to find that the "wrap selection in open/close tags" bundle item wraps the '''whole''' selection in p, rather than detecting each individual paragraph, as BBEdit does. To make this work as expected, open the Bundle editor. Select the bundle "Wrap each selected Line in Open/Close Tag" and duplicate it. Edit the duplicate to use p rather than li. Give it key equivalent (I use Cmd-P, since this is such a common action). -- S Hacker
February 10, 2007, at 20:33 UTC by Tolmark -
Added line 491:
'''The following link is broken, if someone has another resource, please post it. '''\\
Added line 494:
'''The following two links are also broken, if someone has another resource, please post it. '''\\
February 08, 2007, at 15:39 UTC by Christian Tan -
Added line 41:
* [[#Macfuse | How to edit remote files using macfuse and sshfs]]
Added lines 648-661:

[[#Macfuse]]
!!How to edit remote files using macfuse and sshfs - '''Christian Tan'''


One major annoyance for me was being unable to use textmate project management for files on my server. I used to use cyberduck with textmate, which works ok, but this one is more conveniant:

Install [[http://code.google.com/p/macfuse/|macfuse]]

Mount your remote server using sshfs:

sshfs user@servername:/ ~/mnt/servername -oping_diskarb,volname=servername'

Now on the commandline on my laptop, I go to any file in ~/mnt/servername/ and do: mate <filename> and I can just add files to a projectdrawer in textmate. Best of all is that you do not need to prepare anything on your server if it is already running ssh.
February 05, 2007, at 19:08 UTC by Arnar Birgisson -
Added line 10:
** [[#ChangeTabsizeWithSofttabs | Change the tabsize with softtabs]]
Changed lines 256-264 from:
!! PHP Tricks [[#PHPTricks]]

[[#PHPCodeCompletion]]
!!! PHP code completion - ''Ian White''
I've created a couple of scripts that give the effect of code completion.
Description and download at http://ian.ardes.com/phpcc

!!! PHP documentation command for selected word:
to:
[[#ChangeTabsizeWithSofttabs]]
!!! Change the tabsize of soft-tab files - ''Arnar Birgisson''
This python command takes every 3 spaces at the beginning of a line and adds one more, effectively moving from 3sp soft-tabs to 4sp ones. Change the numbers at will, although you need to change it more if you want to decrease the tabsize.\\
Input: Selected Text or Document\\
Output: Replace Selected Text
Added lines 263-287:
#!/usr/bin/env python

import os
import re
from sys import stdout, stdin, exit

r = re.compile('^( +)')

for line in stdin:
m = r.match(line)
if m:
c = len(m.group(1))
stdout.write(' ' * (c/3))
stdout.write(line)=]

!! PHP Tricks [[#PHPTricks]]

[[#PHPCodeCompletion]]
!!! PHP code completion - ''Ian White''
I've created a couple of scripts that give the effect of code completion.
Description and download at http://ian.ardes.com/phpcc

!!! PHP documentation command for selected word:

%block bgcolor=#dfd border='1px solid black' padding=5px% [=
January 08, 2007, at 05:29 UTC by Albert Davidson Chou -
Added line 7:
** [[#StripTrailingWhitespaceOnSave | Automatically strip trailing spaces when you save]]
Changed lines 192-193 from:
Now every time you save with Cmd-S, TM will prompt you with a dialog box asking for a log message and checkin the file, and recheck it out. If you include the $Id$ and $Log$ tags you can see the information about the revision and pervious log messages.
to:
Now every time you save with Cmd-S, TM will prompt you with a dialog box asking for a log message and checkin the file, and recheck it out. If you include the $Id$ and $Log$ tags you can see the information about the revision and pervious log messages.

!!! Automatically strip trailing whitespace each time you save - ''Albert Davidson Chou'' [[#StripTrailingWhitespaceOnSave]]

In every editor I use that has a setting to strip trailing whitespace on save, I enable it. TextMate doesn't have one, but it does have a command to strip trailing whitespace, so you can make a copy of that command and set its key equivalent to Cmd-S to get the same functionality:

%block bgcolor=#dfd border='1px solid black' padding=5px% \
'''Save:''' Nothing \\
'''Command(s):''' \\
@@perl -pe 's/[\t ]+$//g'@@ \\
'''Std In:''' Entire Document \\
'''Std Out:''' Replace Document \\
'''Activation:''' Key Equivalent Cmd-S
%%
September 14, 2006, at 16:32 UTC by Michael Lehmkuhl -
Deleted line 18:
** [[#BBEditFindDifferences | Send Front Files to BBEdit "Find Differences..."]]
Deleted lines 421-476:
!!! Send Front Files to BBEdit "Find Differences..." - ''Provided by Michael Lehmkuhl'' [[#BBEditFindDifferences]]

Finds the two frontmost TextMate documents that have valid paths and sends them to BBEdit for diff'ing.

%block bgcolor=#dfd border='1px solid black' padding=5px% \
'''Save:''' Nothing \\
'''Command(s):''' \\
@@/usr/bin/osascript -e '@@ \\
@@set file1 to ""@@ \\
@@set file2 to ""@@ \\
@@@@ \\
@@tell application "TextMate"@@ \\
@@ repeat with doc in documents@@ \\
@@ try@@ \\
@@ set file1 to the path of doc@@ \\
@@ on error@@ \\
@@ set file1 to ""@@ \\
@@ end try@@ \\
@@ end repeat@@ \\
@@ repeat with doc in documents@@ \\
@@ try@@ \\
@@ if the path of doc is not file1 then@@ \\
@@ set file2 to the path of doc@@ \\
@@ end if@@ \\
@@ on error@@ \\
@@ set file2 to ""@@ \\
@@ end try@@ \\
@@ end repeat@@ \\
@@ set okgo to false@@ \\
@@ try@@ \\
@@ if (file1 is not "") and (file2 is not "") then@@ \\
@@ set okgo to true@@ \\
@@ end if@@ \\
@@ end try@@ \\
@@end tell@@ \\
@@@@ \\
@@if okgo then@@ \\
@@ tell application "BBEdit"@@ \\
@@ set r to compare (POSIX file file1) against (POSIX file file2)@@ \\
@@ if differences found of r is false then@@ \\
@@ return reason for no differences of r@@ \\
@@ else@@ \\
@@ activate@@ \\
@@ end if@@ \\
@@ end tell@@ \\
@@else@@ \\
@@ return "At least two saved files must be open in TextMate to run this command."@@ \\
@@end if@@ \\
@@';@@ \\
'''Input:''' None \\
'''Output:''' Show as Tool Tip
%%



September 12, 2006, at 06:58 UTC by Michael Lehmkuhl -
Added line 19:
** [[#BBEditFindDifferences | Send Front Files to BBEdit "Find Differences..."]]
Added lines 421-478:


!!! Send Front Files to BBEdit "Find Differences..." - ''Provided by Michael Lehmkuhl'' [[#BBEditFindDifferences]]

Finds the two frontmost TextMate documents that have valid paths and sends them to BBEdit for diff'ing.

%block bgcolor=#dfd border='1px solid black' padding=5px% \
'''Save:''' Nothing \\
'''Command(s):''' \\
@@/usr/bin/osascript -e '@@ \\
@@set file1 to ""@@ \\
@@set file2 to ""@@ \\
@@@@ \\
@@tell application "TextMate"@@ \\
@@ repeat with doc in documents@@ \\
@@ try@@ \\
@@ set file1 to the path of doc@@ \\
@@ on error@@ \\
@@ set file1 to ""@@ \\
@@ end try@@ \\
@@ end repeat@@ \\
@@ repeat with doc in documents@@ \\
@@ try@@ \\
@@ if the path of doc is not file1 then@@ \\
@@ set file2 to the path of doc@@ \\
@@ end if@@ \\
@@ on error@@ \\
@@ set file2 to ""@@ \\
@@ end try@@ \\
@@ end repeat@@ \\
@@ set okgo to false@@ \\
@@ try@@ \\
@@ if (file1 is not "") and (file2 is not "") then@@ \\
@@ set okgo to true@@ \\
@@ end if@@ \\
@@ end try@@ \\
@@end tell@@ \\
@@@@ \\
@@if okgo then@@ \\
@@ tell application "BBEdit"@@ \\
@@ set r to compare (POSIX file file1) against (POSIX file file2)@@ \\
@@ if differences found of r is false then@@ \\
@@ return reason for no differences of r@@ \\
@@ else@@ \\
@@ activate@@ \\
@@ end if@@ \\
@@ end tell@@ \\
@@else@@ \\
@@ return "At least two saved files must be open in TextMate to run this command."@@ \\
@@end if@@ \\
@@';@@ \\
'''Input:''' None \\
'''Output:''' Show as Tool Tip
%%



August 16, 2006, at 19:23 UTC by anarchitect -
Changed lines 439-440 from:
There is an "Insert color…" command in the CSS bundle that surely works also for other scopes. Selecting a color hex code will bring up a color selector with that color with which one can change the color. Clicking okay will replace the old hex code. Besides the occasional beach ball it is working fine for me. --anarchitect
to:
There is an "Insert color…" command in the CSS bundle that surely works also for other scopes. Selecting a color hex code and calling upon Cmd-Shift-C will bring up a color selector with that color with which one can change the color. Clicking okay will replace the old hex code. Besides the occasional beach ball it is working fine for me. --anarchitect
August 16, 2006, at 19:22 UTC by anarchitect -
Added lines 439-440:
There is an "Insert color…" command in the CSS bundle that surely works also for other scopes. Selecting a color hex code will bring up a color selector with that color with which one can change the color. Clicking okay will replace the old hex code. Besides the occasional beach ball it is working fine for me. --anarchitect
August 13, 2006, at 04:45 UTC by William Scott -
Added line 16:
** [[#FinderToolbarIcon | Finder Toolbar Icon]]
Changed lines 339-347 from:





!!! Applescript to open the current file in an arbitrary application - ''Jeroen van der Ham'' [[#OpenFile]]

Perhaps this is peanuts for people who know Applescript, but I searched for a couple of hours before I could find how to use Unix-style filepaths in an applescript:
to:
!!! Finder Toolbar Icon - ''William Scott'' [[#FinderToolbarIcon]]

Save this as an AppleScript application, give it a nice icon, and put it in the Finder toolbar. Clicking it opens a TextMate project corresponding to the directory displayed in the Finder.
Changed lines 344-347 from:
osascript -e "tell application \"Preview\"
activate
open POSIX file \"${TM_FILEPATH\"
end tell"
to:
try
tell application "Finder" to set the source_folder to (folder of the front window)
on error -- no open folder windows
set the source_folder to path to desktop folder as alias
set source to source_folder as alias
end try

if kind of source_folder = "folder" then
set source to source_folder as alias
set ThePath to (POSIX path of the source as string)
else
set the source_folder to the folder of source_folder
set source to source_folder as alias
set ThePath to (POSIX path of source as string)
set the result to ThePath
end if
set TheCommand to "open -a TextMate " & quoted form of ThePath
do shell script TheCommand
Changed lines 364-365 from:
This command be useful for example when editing @@.tex@@ files, running @@latex@@ over it and previewing the resulting PDF in one go. In which case you need to replace the extension as well, so then you should use the line below.
to:

!!! Applescript to open the current file in an arbitrary application - ''Jeroen van der Ham'' [[#OpenFile]]

Perhaps this is peanuts for people who know Applescript, but I searched for a couple of hours before I could find how to use Unix-style filepaths in an applescript:
Changed lines 370-373 from:
open POSIX file \"${TM_FILEPATH%/.tex/.pdf}\"
to:
osascript -e "tell application \"Preview\"
activate
open POSIX file \"${TM_FILEPATH\"
end tell"
Changed lines 376-377 from:
This didn't work for me. I used:
to:
This command be useful for example when editing @@.tex@@ files, running @@latex@@ over it and previewing the resulting PDF in one go. In which case you need to replace the extension as well, so then you should use the line below.
Changed line 379 from:
open POSIX file \"${TM_FILEPATH%.tex}.pdf\"
to:
open POSIX file \"${TM_FILEPATH%/.tex/.pdf}\"
Added lines 382-387:
This didn't work for me. I used:

%block bgcolor=#dfd border='1px solid black' padding=5px% [=
open POSIX file \"${TM_FILEPATH%.tex}.pdf\"
=]
August 13, 2006, at 03:11 UTC by William Scott -
Changed line 329 from:
@@ write text "cd '$TM_PATH'; clear; pwd"@@ \\
to:
@@ write text "cd '$TM_DIRECTORY'; clear; pwd"@@ \\
August 13, 2006, at 00:28 UTC by William Scott -
Added line 15:
** [[#OpeniTerm | Open iTerm Here]]
Changed lines 314-316 from:
!! Applescript [[#Applescript]]
!!! Open iTerm Here - ''William Scott'' [[#OpeniTerml]]
to:

!!! Open iTerm Here - ''William Scott'' [[#OpeniTerm]]
Changed lines 337-341 from:
%%



to:





Changed line 583 from:
(You guys are smart enough to work out my email address from that)
to:
(You guys are smart enough to work out my email address from that)
August 13, 2006, at 00:23 UTC by William Scott -
Added lines 312-340:

!! Applescript [[#Applescript]]
!!! Open iTerm Here - ''William Scott'' [[#OpeniTerml]]

Opens an iTerm tabbed window in the current file's directory.

%block bgcolor=#dfd border='1px solid black' padding=5px% \
'''Before running command:''' Do nothing \\
'''Command(s):''' \\
@@ osascript <<EOF@@ \\
@@ tell application "iTerm"@@ \\
@@ make new terminal@@ \\
@@ tell the first terminal@@ \\
@@ activate current session@@ \\
@@ launch session "Default Session"@@ \\
@@ tell the last session@@ \\
@@ write text "cd '$TM_PATH'; clear; pwd"@@ \\
@@ end tell@@ \\
@@ end tell@@ \\
@@ end tell@@ \\
@@EOF@@ \\
'''Standard input:''' None \\
'''Standard output:''' Discard
%%
%%



August 12, 2006, at 22:30 UTC by JRGould -
Changed lines 275-276 from:
'''Update'''
I have updated M.Spreij's pdoc to further refine this great functionality. You can grab the source [[here -> http://jrgould.net/pdoc.html]].
to:
'''Update:'''
I have updated M.Spreij's pdoc to further refine this great functionality. You can grab the source [[here -> http://jrgould.net/pdoc/index.html]].
August 12, 2006, at 21:40 UTC by JRGould -
Added lines 274-278:
----
'''Update'''
I have updated M.Spreij's pdoc to further refine this great functionality. You can grab the source [[here -> http://jrgould.net/pdoc.html]].
----
August 04, 2006, at 21:25 UTC by Marc -
Added line 26:
** [[#ASgetterssetters2 | Create Getters/Setters (another way)]]
Added lines 416-421:

!!! Create Getters/Setters 2 - ''Marc Bauer'' [[#ASgetterssetters2]]

Another way to create getters/setters in ActionScript2 described [[http://nesium.com/blog/2006/08/04/actionscript-gettersetter-command-for-textmate/ | here]]

July 14, 2006, at 23:26 UTC by Monokai -
Changed lines 398-399 from:
http://www.monokai.nl/asDev/
to:
http://www.monokai.nl/blog/2006/07/14/using-textmate-mtasc-and-xtrace-to-build-flash-projects-in-mac-osx/
July 09, 2006, at 00:59 UTC by Michael Lehmkuhl -
Changed line 143 from:
@@THETIME=`php -r 'print date('his');'`@@ \\
to:
@@THETIME=`php -r 'print date('His');'`@@ \\
July 03, 2006, at 09:48 UTC by Monokai -
Added line 24:
** [[#ASmtasc | Using Textmate, MTASC and XTrace to build Flash projects]]
Changed line 397 from:
!!! Using Textmate, Mtasc and Xtrace to build Flash projects:
to:
!!! Using Textmate, MTASC and XTrace to build Flash projects [[#ASmtasc]]
July 03, 2006, at 00:05 UTC by Monokai -
Added lines 396-398:
!!! Using Textmate, Mtasc and Xtrace to build Flash projects:
http://www.monokai.nl/asDev/
June 28, 2006, at 03:27 UTC by Ben Perry -
Changed lines 533-536 from:
'''Activation:''' Key Equivalent Ctrl-Shft-A
to:
'''Activation:''' Key Equivalent Ctrl-Shft-A

Any queries contact my gmail.com account. avenjamin is the username.
(You guys are smart enough to work out my email address from that)
June 28, 2006, at 03:25 UTC by Ben Perry -
Changed line 487 from:
%block bgcolor=#dfd border='1px solid black' padding=5px% [=
to:
%block bgcolor=#dfd border='1px solid black' padding=5px% [=
June 28, 2006, at 03:23 UTC by Ben Perry -
Added line 34:
* [[#Subversion | Subversion Checkout]]
Added lines 479-533:

!! Subversion Checkout [[#Subversion]]

Not sure how useful this is to other people. But I have written a command for the Subversion bundle that lets me do a checkout. It asks for the url and then where to save it. Progress bar appears while checkout happens. Once done, then opens project in TextMate. The url format I have for my host is svn-ssh:// not sure how similar that is for other users.

'''Save:''' Nothing \\
'''Command(s):'''

%block bgcolor=#dfd border='1px solid black' padding=5px% [=
# Setup Dialog asking for host
url=$(CocoaDialog inputbox \
--title "Checkout..." \
--informative-text "Enter the host:" \
--text "svn+ssh://" \
--button1 "Checkout" \
--button2 "Cancel")

# If user canceled exit.
[[ $( (tail -r <<<"$url") | tail -n1) == "2" ]] && \
exit_discard

# url contains the url entered
url=$(tail -n1 <<<"$url")

# -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= #

# Setup Dialog asking where to save
location=$(CocoaDialog fileselect \
--text "Select Folder to Checkout to" \
--select-only-directories \
--with-directory "~/")

# If user canceled exit.
[[ $( (tail -r <<<"$location") | tail -n1) == "2" ]] && \
exit_discard

# location contains the location selected
location=$(tail -n1 <<<"$location")

res=$({
cd $location
svn checkout --quiet $url
} > >(CocoaDialog progressbar \
--indeterminate \
--title "Checking Out" \
--text "Please wait, this could take some time"))

project=`basename $url`

open -b com.macromates.TextMate "$location/$project"
=]

'''Std In:''' None \\
'''Std Out:''' Insert as Snippet \\
'''Activation:''' Key Equivalent Ctrl-Shft-A
June 19, 2006, at 21:26 UTC by JasonBrown -
Changed lines 439-440 from:
# Go into the extension preferences (Firefox->Tools->Extension Manager->mozex->Preferences). In the "Textarea" tab put:
to:
# Go into the extension preferences (Firefox->Tools->Extension Manager->mozex->Preferences). In the "Textarea" tab put: "/usr/bin/mate -w %t" (or whichever path you chose when you created the symbolic link to mate through TextMate).

'''In OS X:'''
In the "Textarea" tab put:
Deleted lines 447-448:
(If your TextMate application is not in the main applications folder, you'll need to enter the path to where you have it)
June 19, 2006, at 20:26 UTC by JasonBrown -
Added line 434:
Changed lines 439-441 from:
# Go into the extension preferences (Firefox->Tools->Extension Manager->mozex->Preferences) and in the textarea set the command to: "/usr/bin/mate -w %t" (or whichever path you chose when you created the symbolic link to mate through TextMate).
# You can now edit textareas by right clicking and choosing MozEx ->Edit textarea. The text will open up in TextMate which you can then edit. When you have finished and saved the file, you just need to click in the textarea for the contents to update to the changes you have made.
to:
# Go into the extension preferences (Firefox->Tools->Extension Manager->mozex->Preferences). In the "Textarea" tab put:

%block bgcolor=#dfd border='1px solid black' padding=5px% [=
/Applications/TextMate.app/Contents/Resources/mate -w %t
=]

(If your TextMate application is not in the main applications folder, you'll need to enter the path to where you have it)

You can now edit textareas by right clicking and choosing MozEx ->Edit textarea. The text will open up in TextMate which you can then edit. When you have finished and saved the file, you just need save the file or, click in the textarea for the contents to update with the changes you made in TextMate.

Added line 452:
June 01, 2006, at 09:23 UTC by Catfish -
Deleted lines 449-450:
''Is there any way to persuade TextMate to work with the CSS Editor (in the Web Developer extension) ?''
May 25, 2006, at 09:58 UTC by Catfish -
Added lines 441-442:
''Is there any way to persuade this to work with the CSS Editor (in the Web Developer extension) ?''
Added lines 450-451:
''Is there any way to persuade TextMate to work with the CSS Editor (in the Web Developer extension) ?''
May 14, 2006, at 17:45 UTC by Gautam Dey -
Added lines 157-187:
!!! Automatically back you files to a RCS repository each time you save. - ''Gautam Dey'' [[#BackupOnSaveWithRCS]]
This based on the [[#BackupOnSave| Backup On Save]] tip. However, I wanted my backup to use [[http://www.gnu.org/software/rcs/rcs.html | RCS]], which comes pre-installed on the OS X. (At least with Tiger. Don't know about the older versions.) So, I wrote up this command,
at current it creates an RCS directory in the same folder as the file, and check's in the file to that directory. It also rechecks out the file.
following command:
%block bgcolor=#dfd border='1px solid black' padding=5px% \
'''Save:''' Current File \\
'''Command(s):''' \\
%block bgcolor=#dfd border='1px solid black' padding=5px% \
[=
# Check to see if the directory exists, if not create it.
[[ -d RCS ]] || mkdir RCS
# Ask for a Log message.
res=$(CocoaDialog inputbox \
--title "Message for rcs" \
--informative-text "Message for rcs:" \
--button1 "Okay" \
--button2 "Cancel")
# If user canceled exit.
[[ $( (tail -r <<<"$res") | tail -n1) == "2" ]] && \
exit_discard
res=$(tail -n1 <<<"$res")
ci -l -m"$res" $TM_FILEPATH
=]
%block bgcolor=#dfd border='1px solid black' padding=5px% \
'''Std In:''' None \\
'''Std Out:''' Show as Tooltip \\
'''Activation:''' Key Equivalent Cmd-S
%%

Now every time you save with Cmd-S, TM will prompt you with a dialog box asking for a log message and checkin the file, and recheck it out. If you include the $Id$ and $Log$ tags you can see the information about the revision and pervious log messages.
May 01, 2006, at 16:02 UTC by Allan Odgaard -
Changed line 33 from:
* [[#reOpenWithEncoding | How to re-open with more than the default encodings]]
to:
* [[#reOpenWithEncoding | How to re-open with other than the default encodings]]
Changed lines 433-434 from:
This can be done by using @@iconv@@, see [[http://lists.macromates.com/pipermail/textmate/2006-April/009733.html | this letter]] for an example bundle which add new re-open with encoding commands via a bundle.
to:
This can be done by using @@iconv@@, see [[http://lists.macromates.com/pipermail/textmate/2006-April/009733.html | this letter]] for an example bundle which adds new re-open with encoding commands through a bundle.
May 01, 2006, at 16:01 UTC by Allan Odgaard -
Added line 33:
* [[#reOpenWithEncoding | How to re-open with more than the default encodings]]
Changed lines 429-434 from:
Instructions are in [[http://lists.macromates.com/pipermail/textmate/2006-February/008276.html | this letter from the mailing list]].
to:
Instructions are in [[http://lists.macromates.com/pipermail/textmate/2006-February/008276.html | this letter from the mailing list]].

!! How to re-open with more than the default encodings [[#reOpenWithEncoding]]

This can be done by using @@iconv@@, see [[http://lists.macromates.com/pipermail/textmate/2006-April/009733.html | this letter]] for an example bundle which add new re-open with encoding commands via a bundle.
May 01, 2006, at 15:57 UTC by Allan Odgaard -
Added line 32:
* [[#defaultLanguage | How to set the default language for new (untitled) documents]]
Added lines 426-428:
!! How to set the default language for new (untitled) documents [[#defaultLanguage]]

Instructions are in [[http://lists.macromates.com/pipermail/textmate/2006-February/008276.html | this letter from the mailing list]].
April 29, 2006, at 05:50 UTC by tim martin -
Changed line 19 from:
** [[#HTMLColor | Drop Colorcodes From Pref's Colorwheel]]
to:
** [[#HTMLColor | Access Color Palette]]
Changed line 339 from:
!!! Drop Colorcodes From Pref's Colorwheel [[#HTMLColor]]
to:
!!! Access Color Palette [[#HTMLColor]]
Added lines 343-344:
If you have Interface Builder (part of the dev tools) you can open up TextMate's MainMenu.nib and create a menu item that opens the color window. It's easiest to open a "new" IB nib selecting the "cocoa application" template, go copy the menu item you want "show colors" and then paste it into TextMate's menu nib. Save and open TextMate and test it out. -- Tim Martin
April 28, 2006, at 12:47 UTC by niko -
Added lines 151-152:
Or you add a "du -hd 0 "$TM_BACKUP_DIR"" and output to a tooltip to keep track of the size of you backupdir.
April 23, 2006, at 19:54 UTC by David Powers -
Added line 30:
* [[#Thunderbird | Hints for integration with Thunderbird]]
Added lines 404-410:
!! Integration with Thunderbird [[#Thunderbird]]
You can use TextMate to edit emails from Thunderbird.

# Get a copy of the External Editor extension from [[http://globs.org/articles.php?lng=en&pg=2]] and install it from the Tools -> Extensions dialog in Thunderbird
# Follow the installation instructions on the page
# Set the editor to /usr/bin/mate -w in the extension preferences
April 10, 2006, at 17:45 UTC by Andrew Henson -
Changed lines 396-402 from:
to:
!! Addendum to integrating with Firefox 1.5

# Go to http://mozex.mozdev.org/development.html and download the (currently development version) MozEx 2.0 and install it into Firefox.

# Go into the extension preferences (Firefox->Tools->Extension Manager->mozex->Preferences) and in the textarea set the command to: "/usr/bin/mate -w %t" (or whichever path you chose when you created the symbolic link to mate through TextMate).
# You can now edit textareas by right clicking and choosing MozEx ->Edit textarea. The text will open up in TextMate which you can then edit. When you have finished and saved the file, you just need to click in the textarea for the contents to update to the changes you have made.
April 04, 2006, at 11:47 UTC by Daniel Käsmayr -
Changed lines 397-398 from:
!! How to extend an existing bundle [[#extendBundle]]
to:
!! How to extend an existing bundle [[#bundleExtension]]
March 29, 2006, at 21:34 UTC by Daniel Käsmayr -
Added line 30:
* [[#bundleExtension | How to extend or override an existing bundle]]
Changed lines 394-406 from:
--[[Profiles/Karsten W Rohrbach]]
to:
--[[Profiles/Karsten W Rohrbach]]


!! How to extend an existing bundle [[#extendBundle]]

If you want to extend a language grammar and/or change the behavior of one bundle without actually modifying that bundle itself (i.e. you would like to keep your changes separate from the bundle's original code) you will need to do the following:

# create a new bundle
# create a new language grammar. give it a scope name of your.original.scope.someextension: [[<<]]e.g. [=scopeName = 'text.plain.mail.custom';=]
# add your own language grammar, possibly overriding stuff that is in the bundle
# at the end of the language grammar include the original bundle like this: [[<<]][={ include = 'text.plain.mail'; },
=]
March 17, 2006, at 23:41 UTC by Ross -
Changed line 20 from:
** [[#ReformatHTML | #Reformat HTML-TextMate]]
to:
** [[#ReformatHTML | Reformat HTML-TextMate]]
March 17, 2006, at 23:41 UTC by Ross -
Changed line 19 from:
** [[#HTMLColor | Drop Colorcodes From Pref's Colorwheel]
to:
** [[#HTMLColor | Drop Colorcodes From Pref's Colorwheel]]
March 17, 2006, at 23:40 UTC by Ross -
Changed lines 19-20 from:
** [[#HTMLColor | Drop Colorcodes From Pref's Colorwheel]]
to:
** [[#HTMLColor | Drop Colorcodes From Pref's Colorwheel]
** [[#ReformatHTML | #Reformat HTML-TextMate]]
Added lines 339-345:
!!! Reformat HTML-TextMate [[#ReformatHTML]]
Here's my modification of FHTML, a Perl script that re-formats HTML to be more human readable.

(I give it the key command: Command-Option-Shift-F to match BBEdit's "reformat HTML code" command.)

[[http://home.reyman.us/resources/FHTML-TextMate.txt | FHTML-TextMate.txt ]]
March 10, 2006, at 13:09 UTC by Maarten Spreij -
Added line 8:
** [[#ChangeLeadingSpacesToTabs | Change Leading Spaces To Tabs]]
Changed lines 166-175 from:

!! PHP Tricks [[#PHPTricks]]

[[#PHPCodeCompletion]]
!!! PHP code completion - ''Ian White''
I've created a couple of scripts that give the effect of code completion.
Description and download at http://ian.ardes.com/phpcc

!!! PHP documentation command for selected word:
to:
[[#ChangeLeadingSpacesToTabs]]
!!! Change Leading Spaces To Tabs - ''M Spreij''
Bit of PHP code that does what the title says.. you can change the number of spaces one tab will replace. Leftover spaces will stay put.\\
Input: Selected Text\\
Output: Replace Selected Text
Added lines 173-207:
#!/usr/bin/php
<?php
$fetch = fread(STDIN, 100);
if (! strlen($fetch)) {
return;
}

# set this to what you want
$tablength = 2;

$data = $fetch;

while (strlen($fetch)) {
$fetch = fread(STDIN, 1000);
$data .= $fetch;
}

$output = '';
foreach(explode("\n", $data) as $line) {
$len = floor(strspn($line, " ") / $tablength);
$output .= str_repeat("\t", $len) . substr($line, $tablength * $len) . "\n";
}
echo substr($output, 0, -1);
?>=]

!! PHP Tricks [[#PHPTricks]]

[[#PHPCodeCompletion]]
!!! PHP code completion - ''Ian White''
I've created a couple of scripts that give the effect of code completion.
Description and download at http://ian.ardes.com/phpcc

!!! PHP documentation command for selected word:

%block bgcolor=#dfd border='1px solid black' padding=5px% [=
March 06, 2006, at 05:16 UTC by Dion Almaer -
Changed line 208 from:
Standard input: Selected Text
to:
Standard input: None
March 06, 2006, at 05:13 UTC by Dion Almaer -
Added line 11:
** [[#PHPProjectFunctions | PHP Project Functions]]
Changed lines 201-216 from:
to:
!!! PHP Project Functions - "Dion Almaer" [[#PHPProjectFunctions]]

Goes through the project directory and groks out all functions. If you select some text it will narrow it to that.

%block bgcolor=#dfd border='1px solid black' padding=5px% [=
Before running command: Nothing
Command(s): grep -E -n -r --include=\*.php --exclude=.svn "function ${TM_SELECTED_TEXT:-$TM_CURRENT_WORD}\w+\s*\(" ${TM_PROJECT_DIRECTORY:-$TM_DIRECTORY}
Standard input: Selected Text
Standard output: Show in separate window
Pattern: ^(.+):(\d+):(.*)$
Format String: $1, line $2: $3
File Register: 1
Line: 2
=]

February 19, 2006, at 03:20 UTC by Jason Froderman -
Changed line 305 from:
## Run preg_replace to take variable declarations
to:
## Run preg_replace_callback to take variable declarations
February 19, 2006, at 03:13 UTC by Jason Froderman -
Added lines 313-314:
http://froderman.com/index.php?option=com_content&task=view&id=25&Itemid=48
February 19, 2006, at 02:54 UTC by Jason Froderman -
Added line 21:
** [[#ASgetterssetters | Create Getters/Setters (AS2)]]
Changed lines 300-301 from:
!!! Create Getters/Setters - ''Jason Froderman'' [[#PrefixSuffix]]
to:
!!! Create Getters/Setters - ''Jason Froderman'' [[#ASgetterssetters]]
February 19, 2006, at 02:51 UTC by Jason Froderman -
Added lines 299-311:
!!! Create Getters/Setters - ''Jason Froderman'' [[#PrefixSuffix]]

%block bgcolor=#dfd border='1px solid black' padding=5px% [=
- Save: Nothing
- Command:
## Run preg_replace to take variable declarations
## and create getter/setter method

php -r 'echo preg_replace_callback("|(\w+) (\w+) (\w+):(\w+);|", create_function("\$matches","return \"\npublic function get\".ucfirst(\$matches[3]).\"():\".\$matches[4].\" {\n\treturn \".\$matches[3].\"; \n}\n\n\".\$matches[1].\" function set\".ucfirst(\$matches[3]).\"(\".\$matches[3].\":\".\$matches[4].\"):Void {\n\tthis.\".\$matches[3].\" = \".\$matches[3].\";\n}\";"), file_get_contents("/dev/stdin") );';
- Input: Selected text
- Output: Insert as text
=]
February 12, 2006, at 09:23 UTC by Richstyles -
Changed lines 308-311 from:
!!! Input backslash character - ''OGURA Toshiyuki a.k.a. OGURADIO''
I've created a document that may help Japanese keymap users to type in backslash character in TextMate documents.
Description at http://www.oguradio.com/blog/archives/2005/09/textmate.html
to:
February 12, 2006, at 09:21 UTC by Richstyles -
Deleted lines 22-24:
** [[#PyMatePythonPath | Change the version of python PyMate uses]]
* [[#LaTeX | LaTeX Tips ]]
** [[#latexPDFSYNC | Enabling PDFsync ]]
Deleted lines 25-27:
* [[#Java | Java]]
** [[#PMD | Integrating PMD]]
** [[#Checkstyle | Integrating Checkstyle]]
Changed lines 50-51 from:
!!! Sum all numbers following a '$', useful for adding costs - ''[[profiles/ Jim Bagrow]]'' [[#AddCosts]]
to:
!!! Sum all numbers following a '$', useful for adding costs - ''Jim Bagrow'' [[#AddCosts]]
Changed lines 54-57 from:
more appropriate. Feel free to improve! Modification to other currency symbols should be obvious.

* '''Update:''' TM has a Math bundle, which can be used pretty much to do exactly what this tip does. I think it's useful to keep this tip around for the python/regex example of matching to the dollar signs. -- [[profiles/ Jim Bagrow]]
to:
more appropriate. Feel free to improve!
Changed lines 299-301 from:
!! Ruby/Python [[#RubyPython]]

!!! Find class or method definition [[#RFindDefinition]]
to:
!! Find class or method definition [[#RFindDefinition]]
Changed lines 305-326 from:
!!! Change the version of python PyMate uses [[#PyMatePythonPath]]

- In the "Advanced" pane of TextMate preferences, choose the "Shell Variables" tab.
- Create a new shell variable by clicking the + symbol.
- Set the variable to TM_PYTHON
- Set the value to the full path (doesn't work with /usr/bin/env python entries).


!! LaTeX Tips [[#LaTeX]]

!!! Enabling PDFsync [[#latexPDFSYNC]]

Here's what I needed to go through to get PDFsync working on my machine. YMMV. I'm using texniscope as the viewer.

* [[ http://itexmac.sourceforge.net/pdfsync.html |Download pdfsync]]. Following the download page, drag the necessary files to your ''~/Library/'' directory. The ''texmf'' folder didn't exist in my library so I just dragged the whole thing over.
* Specify the LaTeX Viewer in TM's prefs. Go to the '''Advanced''' preference pane and click on the '''Shell Variables''' tab. Add a new variable called '''TM_LATEX_VIEWER''' with Value ''TeXniscope''.
* Tell TeXniscope to use TM as the editor. Go to TeXniscope's preferences and click the '''paths''' tab. Set '''Editor command''' to ''open'' and '''Editor arguments''' to ''[="txmt://open?url=file://%file&line=%line"=]'' (including the quotes).

That should do it. Don't forget to add '''\usepackage{pdfsync}''' in the latex document to tell it to make the necessary sync data! Thanks to [[http://skiadas.dcostanet.net/afterthought/ | Haris Skiadas ]] for explaining most of this in [[http://skiadas.dcostanet.net/afterthought/2006/01/09/textmate-latex-screencast-no-1/ | his screencast]]. Hope this helps!

--[[Profiles/Jim Bagrow]]
to:
!! Tricks for Japanese users [[#JapaneseIssues]]

[[#InputBackslash]]
!!! Input backslash character - ''OGURA Toshiyuki a.k.a. OGURADIO''
I've created a document that may help Japanese keymap users to type in backslash character in TextMate documents.
Description at http://www.oguradio.com/blog/archives/2005/09/textmate.html

You can input a backslash on a Japanese keyboard by holding option and pressing the yen (¥) key.
Changed lines 319-320 from:
# get mozex-helper from [[http://www.noctua.org.uk/paul/software/]], read the documentation and install it by following the detailed instructions you'll find there (you need a C compiler);\\
set editor_command to @@"/usr/bin/mate -w %s"@@
to:
# get mozex-helper from [[http://www.noctua.org.uk/paul/software/]], read the documentation and install it;\\
set editor_command to "/usr/bin/mate -w %s"
Changed lines 324-365 from:
--[[Profiles/Karsten W Rohrbach]]

If you are using FireFox 1.5 It's much simpler. All you have to do is

# Get mozex from [[https://nic-nac-project.de/~kaosmos/mozex107-en.html]] and install it by dragging the .xpi onto the browser
# in Firefox->Tools->Extension Manager->mozex->Preferences set up the temp directory to @@/tmp/@@ and the text area editor to @@'/usr/bin/mate -w %t@@
# done, you can edit text areas with TextMate by right-clicking->mozex->Edit textarea

--Xian


!! Java [[#Java]]

!!! Using PMD [[#PMD]]

First, download and unpack PMD from [[http://pmd.sf.net]]. Unpack it wherever you want. Create a new command called 'PMD' with 'Entire Input' as the input and 'Show as HTML' for output. The command is:

%block bgcolor=#dfd border='1px solid black' padding=5px%
[=
<pmd-dir>/bin/pmd.sh $TM_FILEPATH html <comma separated rules>
=]

Now, run the command on a java file and look at your pretty list of errors. You can read up on all the rules at the link above.

!!! Using Checkstyle [[#Checkstyle]]

Download and unpack Checkstyle from [[http://checkstyle.sf.net/]]. If you feel like grabbing the src release that's fine, but the top release works great. You'll also need an XSLT tool for prettily viewing output. I got it all in a nice package from [[http://www.explain.com.au/oss/libxml2xslt.html]]. The instructions on the page are good, the frameworks go in /Library/Frameworks or wherever, and the tools go somewhere in your path. (Like /usr/local/bin/)

Got all that? Good. Put this in a new command in TextMate:


%block bgcolor=#dfd border='1px solid black' padding=5px%
[=
java -classpath <checkstyle-dir>/checkstyle-all-4.1.jar com.puppycrawl.tools.checkstyle.Main -c <full-path-to-rules-file> -f xml $TM_FILEPATH > /tmp/checkstyle-output.xml ;
xsltproc <checkstyle-dir>/contrib/checkstyle-noframes.xsl /tmp/checkstyle-output.xml
=]

(I can't get line breaks in the green box... am I slow?)

If you don't feel like going through the XSLT stuff, you can replace '-f xml' with '-f text' and delete everything after $TM_FILEPATH.

-- [[Profiles/Kyle Brett]]
to:
--[[Profiles/Karsten W Rohrbach]]
February 10, 2006, at 08:31 UTC by Xian -
Changed lines 349-357 from:
to:
If you are using FireFox 1.5 It's much simpler. All you have to do is

# Get mozex from [[https://nic-nac-project.de/~kaosmos/mozex107-en.html]] and install it by dragging the .xpi onto the browser
# in Firefox->Tools->Extension Manager->mozex->Preferences set up the temp directory to @@/tmp/@@ and the text area editor to @@'/usr/bin/mate -w %t@@
# done, you can edit text areas with TextMate by right-clicking->mozex->Edit textarea

--Xian

February 07, 2006, at 22:03 UTC by Dustin Sallings -
Deleted lines 31-32:
* [[#ASCII | Ascii]]
** [[#CenterText | Center Text]]
Deleted lines 379-386:
!! ASCII [[#ASCII]]

!! Center Text [[#CenterText]]

The following command is useful for centering ASCII text:

echo "$TM_SELECTED_TEXT" | python -c "import sys; print '\n'.join([x.strip().center(80).rstrip() for x in sys.stdin.readlines()])"
February 07, 2006, at 22:00 UTC by Dustin Sallings -
Added lines 32-33:
* [[#ASCII | Ascii]]
** [[#CenterText | Center Text]]
Added lines 382-389:
!! ASCII [[#ASCII]]

!! Center Text [[#CenterText]]

The following command is useful for centering ASCII text:

echo "$TM_SELECTED_TEXT" | python -c "import sys; print '\n'.join([x.strip().center(80).rstrip() for x in sys.stdin.readlines()])"
February 07, 2006, at 03:52 UTC by kingemer -
Added line 23:
** [[#PyMatePythonPath | Change the version of python PyMate uses]]
Changed lines 307-309 from:
!! Find class or method definition [[#RFindDefinition]]
to:
!! Ruby/Python [[#RubyPython]]

!!! Find class or method definition [[#RFindDefinition]]
Added lines 315-322:
!!! Change the version of python PyMate uses [[#PyMatePythonPath]]

- In the "Advanced" pane of TextMate preferences, choose the "Shell Variables" tab.
- Create a new shell variable by clicking the + symbol.
- Set the variable to TM_PYTHON
- Set the value to the full path (doesn't work with /usr/bin/env python entries).

February 04, 2006, at 21:13 UTC by Dan Kelley -
Changed line 331 from:
# get mozex-helper from [[http://www.noctua.org.uk/paul/software/]], read the documentation and install it;\\
to:
# get mozex-helper from [[http://www.noctua.org.uk/paul/software/]], read the documentation and install it by following the detailed instructions you'll find there (you need a C compiler);\\
Changed lines 338-339 from:
--I can't get this working, with Firefox 1.5.0.1. The call to TextMate produces an error about @@%s@@ being unknown. This is odd, since I can type @@/usr/bin/mate -w %s@@ in the shell and it works. Any advice from anywone? [[Profiles/Dan Kelley]]
to:
February 04, 2006, at 18:09 UTC by Dan Kelley -
Changed lines 338-339 from:
--I can't get this working, with Firefox 1.5.0.1. The call to TextMate produces an error about @@%s@@ being unknown. This is odd, since I can type @@/usr/bin/mate -w %s@@ in the shell and it works. Any advice from anywone? [[Profiles/Dan Kelley]
to:
--I can't get this working, with Firefox 1.5.0.1. The call to TextMate produces an error about @@%s@@ being unknown. This is odd, since I can type @@/usr/bin/mate -w %s@@ in the shell and it works. Any advice from anywone? [[Profiles/Dan Kelley]]
February 04, 2006, at 18:07 UTC by Dan Kelley -
Added lines 338-339:
--I can't get this working, with Firefox 1.5.0.1. The call to TextMate produces an error about @@%s@@ being unknown. This is odd, since I can type @@/usr/bin/mate -w %s@@ in the shell and it works. Any advice from anywone? [[Profiles/Dan Kelley]
February 04, 2006, at 18:03 UTC by Dan Kelley -
Changed line 332 from:
set editor_command to "/usr/bin/mate -w %s"
to:
set editor_command to @@"/usr/bin/mate -w %s"@@
February 01, 2006, at 16:05 UTC by Kyle Brett -
Changed line 360 from:
java -classpath <checkstyle-dir>/checkstyle-all-4.1.jar com.puppycrawl.tools.checkstyle.Main -c <full-path-to-rules-file> -f xml $TM_FILEPATH > /tmp/checkstyle-output.xml
to:
java -classpath <checkstyle-dir>/checkstyle-all-4.1.jar com.puppycrawl.tools.checkstyle.Main -c <full-path-to-rules-file> -f xml $TM_FILEPATH > /tmp/checkstyle-output.xml ;
Added lines 364-365:
(I can't get line breaks in the green box... am I slow?)
January 30, 2006, at 16:49 UTC by Kyle Brett -
Added lines 28-30:
* [[#Java | Java]]
** [[#PMD | Integrating PMD]]
** [[#Checkstyle | Integrating Checkstyle]]
Changed lines 336-366 from:
--[[Profiles/Karsten W Rohrbach]]
to:
--[[Profiles/Karsten W Rohrbach]]

!! Java [[#Java]]

!!! Using PMD [[#PMD]]

First, download and unpack PMD from [[http://pmd.sf.net]]. Unpack it wherever you want. Create a new command called 'PMD' with 'Entire Input' as the input and 'Show as HTML' for output. The command is:

%block bgcolor=#dfd border='1px solid black' padding=5px%
[=
<pmd-dir>/bin/pmd.sh $TM_FILEPATH html <comma separated rules>
=]

Now, run the command on a java file and look at your pretty list of errors. You can read up on all the rules at the link above.

!!! Using Checkstyle [[#Checkstyle]]

Download and unpack Checkstyle from [[http://checkstyle.sf.net/]]. If you feel like grabbing the src release that's fine, but the top release works great. You'll also need an XSLT tool for prettily viewing output. I got it all in a nice package from [[http://www.explain.com.au/oss/libxml2xslt.html]]. The instructions on the page are good, the frameworks go in /Library/Frameworks or wherever, and the tools go somewhere in your path. (Like /usr/local/bin/)

Got all that? Good. Put this in a new command in TextMate:


%block bgcolor=#dfd border='1px solid black' padding=5px%
[=
java -classpath <checkstyle-dir>/checkstyle-all-4.1.jar com.puppycrawl.tools.checkstyle.Main -c <full-path-to-rules-file> -f xml $TM_FILEPATH > /tmp/checkstyle-output.xml
xsltproc <checkstyle-dir>/contrib/checkstyle-noframes.xsl /tmp/checkstyle-output.xml
=]

If you don't feel like going through the XSLT stuff, you can replace '-f xml' with '-f text' and delete everything after $TM_FILEPATH.

-- [[Profiles/Kyle Brett]]
January 29, 2006, at 21:41 UTC by Jim Bagrow -
Changed lines 319-320 from:
That should do it. Don't forget to add '''\usepackage{pdfsync}''' in the latex document to tell it to make the necessary sync data! Thanks to [[http://skiadas.dcostanet.net/afterthought/ | Haris Skiadas ]] for explaining most of this in his [[http://skiadas.dcostanet.net/afterthought/2006/01/09/textmate-latex-screencast-no-1/ | screencast]]. Hope this helps!
to:
That should do it. Don't forget to add '''\usepackage{pdfsync}''' in the latex document to tell it to make the necessary sync data! Thanks to [[http://skiadas.dcostanet.net/afterthought/ | Haris Skiadas ]] for explaining most of this in [[http://skiadas.dcostanet.net/afterthought/2006/01/09/textmate-latex-screencast-no-1/ | his screencast]]. Hope this helps!
January 29, 2006, at 13:08 UTC by Jim Bagrow -
Changed lines 317-318 from:
* Tell TeXniscope to use textmate when syncing. Go to TeXniscope's preferences and click the '''paths''' tab. Set '''Editor command''' to ''open'' and '''Editor arguments''' to ''[="txmt://open?url=file://%file&line=%line"=]'' (including the quotes).
to:
* Tell TeXniscope to use TM as the editor. Go to TeXniscope's preferences and click the '''paths''' tab. Set '''Editor command''' to ''open'' and '''Editor arguments''' to ''[="txmt://open?url=file://%file&line=%line"=]'' (including the quotes).
January 29, 2006, at 13:03 UTC by Jim Bagrow -
Changed lines 52-53 from:
!!! Sum all numbers following a '$', useful for adding costs - ''Jim Bagrow'' [[#AddCosts]]
to:
!!! Sum all numbers following a '$', useful for adding costs - ''[[profiles/ Jim Bagrow]]'' [[#AddCosts]]
Changed lines 56-57 from:
more appropriate. Feel free to improve!
to:
more appropriate. Feel free to improve! Modification to other currency symbols should be obvious.

* '''Update:''' TM has a Math bundle, which can be used pretty much to do exactly what this tip does. I think it's useful to keep this tip around for the python/regex example of matching to the dollar signs. -- [[profiles/ Jim Bagrow]]
January 29, 2006, at 12:48 UTC by Jim Bagrow -
Added lines 23-24:
* [[#LaTeX | LaTeX Tips ]]
** [[#latexPDFSYNC | Enabling PDFsync ]]
Added lines 307-320:
!! LaTeX Tips [[#LaTeX]]

!!! Enabling PDFsync [[#latexPDFSYNC]]

Here's what I needed to go through to get PDFsync working on my machine. YMMV. I'm using texniscope as the viewer.

* [[ http://itexmac.sourceforge.net/pdfsync.html |Download pdfsync]]. Following the download page, drag the necessary files to your ''~/Library/'' directory. The ''texmf'' folder didn't exist in my library so I just dragged the whole thing over.
* Specify the LaTeX Viewer in TM's prefs. Go to the '''Advanced''' preference pane and click on the '''Shell Variables''' tab. Add a new variable called '''TM_LATEX_VIEWER''' with Value ''TeXniscope''.
* Tell TeXniscope to use textmate when syncing. Go to TeXniscope's preferences and click the '''paths''' tab. Set '''Editor command''' to ''open'' and '''Editor arguments''' to ''[="txmt://open?url=file://%file&line=%line"=]'' (including the quotes).

That should do it. Don't forget to add '''\usepackage{pdfsync}''' in the latex document to tell it to make the necessary sync data! Thanks to [[http://skiadas.dcostanet.net/afterthought/ | Haris Skiadas ]] for explaining most of this in his [[http://skiadas.dcostanet.net/afterthought/2006/01/09/textmate-latex-screencast-no-1/ | screencast]]. Hope this helps!

--[[Profiles/Jim Bagrow]]
January 25, 2006, at 15:13 UTC by k -
Deleted lines 304-312:
!! Tricks for Japanese users [[#JapaneseIssues]]

[[#InputBackslash]]
!!! Input backslash character - ''OGURA Toshiyuki a.k.a. OGURADIO''
I've created a document that may help Japanese keymap users to type in backslash character in TextMate documents.
Description at http://www.oguradio.com/blog/archives/2005/09/textmate.html

You can input a backslash on a Japanese keyboard by holding option and pressing the yen (¥) key.
January 01, 2006, at 21:47 UTC by johnatl -
Added line 7:
** [[#LookupWordWithDict | Look up a word at dict.org]]
Changed lines 147-157 from:


!! PHP Tricks [[#PHPTricks]]

[[#PHPCodeCompletion]]
!!! PHP code completion - ''Ian White''
I've created a couple of scripts that give the effect of code completion.
Description and download at http://ian.ardes.com/phpcc

!!! PHP documentation command for selected word:
to:
[[#LookupWordWithDict]]
!!! Look up the current word at www.dict.org. - johnatl
The word does not have to be selected.

You will need to install the dict command. This is simple with port from [[http://darwinports.opendarwin.org/ | DarwinPorts]].
Once dict is installed, create a New Command with the following:
Changed lines 155-157 from:
Before running command: do nothing
Command(s): open http://nl.php.net/$TM_CURRENT_WORD
Standard in/output: None/Discard
to:
Save: Nothing
Command(s): dict "$TM_CURRENT_WORD"
Input: Selected Text or Word
Output: Show as Tool Tip
Changed lines 161-163 from:
!!! PHP Documentation - ''M Spreij'' [[#PHPDocumentation]]
I created a [[PHP shell script -> http://dev.expocom.nl/functions.php?id=64]] that will get just the first few lines (function name, php versions and syntax format) from http://php.net, it was a snap to tie it to a tooltip command as well:
to:
I use Ctrl+Help as the Key Equivalent.


!! PHP Tricks [[#PHPTricks]]

[[#PHPCodeCompletion]]
!!! PHP code completion - ''Ian White''
I've created a couple of scripts that give the effect of code completion.
Description and download at http://ian.ardes.com/phpcc

!!! PHP documentation command for selected word:
Changed lines 175-177 from:
Command(s): ~/bin/pdoc $TM_CURRENT_WORD
Standard input: Selected Text
Standard output: Show as tooltip
to:
Command(s): open http://nl.php.net/$TM_CURRENT_WORD
Standard in/output: None/Discard
Changed lines 179-182 from:
[[Example image -> http://www.mechintosh.com/images/misc/tm.png]]

And this opens the doc page in the browser:
to:
!!! PHP Documentation - ''M Spreij'' [[#PHPDocumentation]]
I created a [[PHP shell script -> http://dev.expocom.nl/functions.php?id=64]] that will get just the first few lines (function name, php versions and syntax format) from http://php.net, it was a snap to tie it to a tooltip command as well:
Changed lines 184-185 from:
Command(s): open http://php.net/$TM_CURRENT_WORD
Standard in/output: None/Discard
to:
Command(s): ~/bin/pdoc $TM_CURRENT_WORD
Standard input: Selected Text
Standard output: Show as tooltip
Changed lines 189-199 from:
to:
[[Example image -> http://www.mechintosh.com/images/misc/tm.png]]

And this opens the doc page in the browser:

%block bgcolor=#dfd border='1px solid black' padding=5px% [=
Before running command: do nothing
Command(s): open http://php.net/$TM_CURRENT_WORD
Standard in/output: None/Discard
=]

December 31, 2005, at 16:14 UTC by juca -
Added lines 20-21:
* [[#RubyPython | Ruby / Python]]
** [[#RFindDefinition | Find class or method definition]]
Added lines 283-288:
!! Find class or method definition [[#RFindDefinition]]
- Input: Selected Text or Word
- Command: grep "[def|class] $TM_SELECTED_TEXT" -l -n -d recurse $TM_PROJECT_DIRECTORY
- Output: Show as tooltip
- Activation: Key Equivalent: Cmd+F1
December 13, 2005, at 09:39 UTC by UltraBob -
Added lines 288-289:
You can input a backslash on a Japanese keyboard by holding option and pressing the yen (¥) key.
November 28, 2005, at 02:50 UTC by Karsten W Rohrbach -
Added line 22:
* [[#Firefox | Hints for integration with Firefox]]
Changed lines 286-298 from:
Description at http://www.oguradio.com/blog/archives/2005/09/textmate.html
to:
Description at http://www.oguradio.com/blog/archives/2005/09/textmate.html

!! Integration with Firefox [[#Firefox]]
You can use TextMate to edit text areas (forms) in Firefox.
This comes in handy when you have to work a lot with CMS software that is only programmable via web interfaces.

# get a hacked-up version of mozex from [[https://nic-nac-project.de/~kaosmos/mozex107-en.html]] and install it by dragging the .xpi onto the browser
# get mozex-helper from [[http://www.noctua.org.uk/paul/software/]], read the documentation and install it;\\
set editor_command to "/usr/bin/mate -w %s"
# in Firefox->Tools->Extension Manager->mozex->Preferences set up the temp directory according to your setting in "mozex-helper.py" and the text area editor to the "mozex-helper" wrapper
# done, you can edit text areas with TextMate by right-clicking->mozex->Edit textarea

--[[Profiles/Karsten W Rohrbach]]
November 23, 2005, at 03:45 UTC by Michael Lehmkuhl -
Added line 6:
** [[#BackupOnSave | Automatically backup your file each time you save]]
Added lines 117-144:
!!! Automatically backup your file each time you save - ''Michael Lehmkuhl'' [[#BackupOnSave]]

A command to enable automatic backup copies of edited files, a la BBEdit's "Make Backup Before Saving" preference.

%block bgcolor=#dfd border='1px solid black' padding=5px% \
'''The Setup:''' Set up a TM_BACKUP_DIR environment variable in the Advanced / Shell Variables \\
section of the TM preferences. Set it to the directory where you'd like your backups to be saved. \\
Use the full path (i.e., /Users/michael/Documents rather than ~/Documents). \\
'''Save:''' Current File \\
'''Command(s):''' \\
@@# Save a copy of this file to the backup directory@@ \\
@@THEDATE=`php -r 'print date('Ymd');'`@@ \\
@@THETIME=`php -r 'print date('his');'`@@ \\
@@mkdir -p "$TM_BACKUP_DIR/$THEDATE"@@ \\
@@perl -e 'while (<STDIN>) { print $_; }' > "$TM_BACKUP_DIR/$THEDATE/$TM_FILENAME.$THEDATE.$THETIME.backup"@@ \\
'''Std In:''' Entire Document \\
'''Std Out:''' Discard \\
'''Activation:''' Key Equivalent Cmd-S
%%

Now each time you save with Cmd-S, TM will also save a copy of the file into your $TM_BACKUP_DIR. It will also organize them into folders for each day at save time.

You may want to run some sort of cron job to clean out the older files in the directory.

Scratch another item off my TextMate wishlist.


November 14, 2005, at 11:34 UTC by Jim Bagrow -
Changed lines 106-107 from:
- Command: grep -n '^[[:space:]]*\(public\|private\|protected\)\?\([[:space:]]\+static\|[[:space:]]\+abstract\)\?[[:space:]]\+function'
to:
- Command: grep -n '^[[:space:]]*\(public\|private\|protected\)\?\([[:space:]]\+static\|
[[:space:]]\+abstract\)\?[[:space:]]\+function'
Changed lines 110-111 from:
- Pattern: ^(\d+):\s(public|private|protected)?(\s+static|\s+abstract)?\s+function\s+([_A-Za-z][_A-Za-z0-9]*)\s*[(](.*)[)]
to:
- Pattern: ^(\d+):\s(public|private|protected)?(\s+static|\s+abstract)?
\s+function\s+([_A-Za-z][_A-Za-z0-9]*)\s*[(](.*)[)]
November 12, 2005, at 03:55 UTC by natebeaty -
Changed lines 200-201 from:
to:
This works great for Transmit also, just replace "Interarchy" with "Transmit". -- natebeaty
November 09, 2005, at 04:56 UTC by pbx -
Changed lines 201-204 from:
!!! Look up current word (doesn't need to be selected) in dictionary (10.4+ only) -- ''Provided by [[Profiles / pbx]]'' [[#LookupWord]]

There's a more simpleminded way to do this, namely the '''dict://''' pseudo-protocol, but it requires Dictionary to be already running and it fails when an exact match is found. This solution overcomes both those problems.
to:
[[#LookupWord]]
!!! Look up current word (doesn't need to be selected) in dictionary (10.4+ only) -- ''Provided by [[Profiles / pbx]]''

There's a more simpleminded way to do this, namely the '''dict://''' pseudo-protocol, but it requires Dictionary to be already running and it fails when an exact match is not found. This solution overcomes both those problems.
November 09, 2005, at 03:55 UTC by pbx -
Added lines 203-204:
There's a more simpleminded way to do this, namely the '''dict://''' pseudo-protocol, but it requires Dictionary to be already running and it fails when an exact match is found. This solution overcomes both those problems.
November 09, 2005, at 03:41 UTC by pbx -
Changed lines 204-205 from:
''Command:''
to:
November 09, 2005, at 03:40 UTC by pbx -
Changed lines 201-202 from:
!!! Look up current word (doesn't need to be selected) in dictionary -- 10.4+ only [[#LookupWord]]
to:
!!! Look up current word (doesn't need to be selected) in dictionary (10.4+ only) -- ''Provided by [[Profiles / pbx]]'' [[#LookupWord]]
Changed lines 218-219 from:
-- [[Profiles / pbx]]
to:
November 09, 2005, at 03:39 UTC by pbx -
Changed lines 204-205 from:
to:
''Command:''
November 09, 2005, at 03:38 UTC by pbx -
Added line 12:
** [[#LookupWord | Look up word in system dictionary (10.4+)]]
Changed lines 200-204 from:
!! HTML [[#HTML]]

!!! Get Image Size
This gets an image's width/height using a command and puts it into a tooltip.
(make sure you select the image filename relative to the current document)
to:

!!! Look up current word (doesn't need to be selected) in dictionary -- 10.4+ only [[#LookupWord]]

''Input:'' none; ''Output:'' Do Nothing
Added lines 206-224:
# Adapted from: http://daringfireball.net/2005/05/dictionary_bbedit
osascript -e "tell application \"Dictionary\" to activate
tell application \"System Events\"
tell process \"Dictionary\"
tell text field 1 of group 1 of tool bar 1 of window \"Dictionary and Thesaurus\"
keystroke \"$TM_CURRENT_WORD\"
keystroke return
end tell
end tell
end tell"
=]
-- [[Profiles / pbx]]

!! HTML [[#HTML]]

!!! Get Image Size
This gets an image's width/height using a command and puts it into a tooltip.
(make sure you select the image filename relative to the current document)
%block bgcolor=#dfd border='1px solid black' padding=5px% [=
October 04, 2005, at 20:34 UTC by Allan Odgaard -
Changed line 117 from:
I’ve created a couple of scripts that give the effect of code completion.
to:
I've created a couple of scripts that give the effect of code completion.
Changed lines 152-153 from:
Opens a Terminal window in the current file’s directory.
to:
Opens a Terminal window in the current file's directory.
Changed line 230 from:
I’ve created a document that may help Japanese keymap users to type in backslash character in TextMate documents.
to:
I've created a document that may help Japanese keymap users to type in backslash character in TextMate documents.
October 02, 2005, at 06:14 UTC by Jim Bagrow -
Added line 3:
** [[#AddCosts | Sum numbers following '$']]
October 02, 2005, at 06:10 UTC by Jim Bagrow -
Changed lines 43-44 from:
!!! Add prefix and suffix to lines - ''Sune Simonsen'' [[#PrefixSuffix]]
to:
!!! Sum all numbers following a '$', useful for adding costs - ''Jim Bagrow'' [[#AddCosts]]

This just goes through the selected text and adds up all the numbers that follow a '$', simple
way to add up costs. Wrote it in python, I'm sure it can be done MUCH more compactly in something
more appropriate. Feel free to improve!
Changed lines 51-71 from:
- Command: sed 's/^/${1:prefix}/' | sed 's/$/${2:suffix}/'
to:
- Command: #!/usr/bin/python

import os
import string
import re

# get selected text from shell:
text = os.getenv('TM_SELECTED_TEXT')

# find all numbers following a $ in selection:
p = re.compile('\$[-+]?([0-9]*\.[0-9]+|[0-9]+)')

result = p.findall(text)
sum_num = sum([float(i) for i in result])
result = ["$"+i for i in result]

output_str = string.join(result, " + ")

print "Sum of costs in selected text:"
print output_str, "= $"+str(sum_num)
Changed line 73 from:
- Std out: Insert as snippet
to:
- Std out: Insert after selected text
Changed lines 76-79 from:
!!! Clickable Function List - ''Eric Hsu'' [[#FunctionList]]

A command to give you a clickable function list in a seperate window. Replace "^sub " with whatever pattern is applicable for your language.
to:
!!! Add prefix and suffix to lines - ''Sune Simonsen'' [[#PrefixSuffix]]
Added lines 79-89:
- Save: Nothing
- Command: sed 's/^/${1:prefix}/' | sed 's/$/${2:suffix}/'
- Std In: Selected text
- Std out: Insert as snippet
=]

!!! Clickable Function List - ''Eric Hsu'' [[#FunctionList]]

A command to give you a clickable function list in a seperate window. Replace "^sub " with whatever pattern is applicable for your language.

%block bgcolor=#dfd border='1px solid black' padding=5px% [=
Changed line 116 from:
Ive created a couple of scripts that give the effect of code completion.
to:
I’ve created a couple of scripts that give the effect of code completion.
Changed lines 151-152 from:
Opens a Terminal window in the current files directory.
to:
Opens a Terminal window in the current file’s directory.
Changed line 229 from:
Ive created a document that may help Japanese keymap users to type in backslash character in TextMate documents.
to:
I’ve created a document that may help Japanese keymap users to type in backslash character in TextMate documents.
September 19, 2005, at 14:33 UTC by OGURA Toshiyuki -
Added lines 17-18:
* [[#JapaneseIssues | Tricks for Japanese users]]
** [[#InputBackslash | Input backslash character]]
Changed lines 190-197 from:
Requires flashcommand: http://weblogs.macromedia.com/mesh/archives/2004/02/flashcommand_fl_1.cfm
to:
Requires flashcommand: http://weblogs.macromedia.com/mesh/archives/2004/02/flashcommand_fl_1.cfm

!! Tricks for Japanese users [[#JapaneseIssues]]

[[#InputBackslash]]
!!! Input backslash character - ''OGURA Toshiyuki a.k.a. OGURADIO''
Ive created a document that may help Japanese keymap users to type in backslash character in TextMate documents.
Description at http://www.oguradio.com/blog/archives/2005/09/textmate.html
September 14, 2005, at 23:06 UTC by M Spreij -
Added line 13:
** [[#HTMLColor | Drop Colorcodes From Pref's Colorwheel]]
Added lines 176-179:
!!! Drop Colorcodes From Pref's Colorwheel [[#HTMLColor]]
TextMate doesn't have a color palette under one of the menus, but you can use the one from the Preferences..
Open the Preferences, go to "Fonts & Colors", click any of the color rectangles *twice* - once to bring up the color palette and again to deselect the rectangle - and close the Preferences window again. Now you can use the color palette to choose a color and drag it into the editing window as a Web #RGB code! -- M Spreij
August 15, 2005, at 06:51 UTC by rc -
Changed lines 182-183 from:
An update of the apparently deprecated method described [[http://macromates.com/wiki/textmate/show/Compile%20your%20actionscript%20project%20from%20TextMate.html | here]].
to:
An update of the apparently deprecated method described [[http://macromates.com/wiki/textmate/show/Compile%20your%20actionscript%20project%20from%20TextMate.html | here]].
Requires flashcommand: http://weblogs.macromedia.com/mesh/archives/2004/02/flashcommand_fl_1.cfm
July 13, 2005, at 01:57 UTC by 60.234.148.217 -
Added line 35:
** A simpler way: @@sed 's=^=//='@@
Changed lines 38-39 from:
to:
** A simpler way: @@sed 's=^[ \t]*//=='@@
May 30, 2005, at 00:29 UTC by Sune Simonsen -
Changed lines 40-43 from:
Make a command that takes the selected text and execute

%block bgcolor=#dfd border='1px solid black' padding=5px% [=
sed 's/^/${1:prefix}/' | sed 's/$/${2:suffix}/'
to:
%block bgcolor=#dfd border='1px solid black' padding=5px% [=
- Save: Nothing
- Command: sed 's/^/${1:prefix}/' | sed 's/$/${2:suffix}/'
- Std In: Selected text
- Std out: Insert as snippet
Deleted lines 46-47:
then select inserts as a snippet.
May 30, 2005, at 00:25 UTC by Sune Simonsen -
Added line 3:
** [[#PrefixSuffix | Add prefix and suffix to lines]]
Deleted line 4:
** [[#PrefixSuffix | Add prefix and suffix to lines]]
May 30, 2005, at 00:24 UTC by Sune Simonsen -
Added line 4:
** [[#PrefixSuffix | Add prefix and suffix to lines]]
Changed lines 38-39 from:
Prefix and suffix a text:
to:
!!! Add prefix and suffix to lines - ''Sune Simonsen'' [[#PrefixSuffix]]
Added lines 41-42:

%block bgcolor=#dfd border='1px solid black' padding=5px% [=
Added lines 44-45:
=]
May 30, 2005, at 00:17 UTC by Sune Simonsen -
Added lines 37-41:
Prefix and suffix a text:
Make a command that takes the selected text and execute
sed 's/^/${1:prefix}/' | sed 's/$/${2:suffix}/'
then select inserts as a snippet.
April 20, 2005, at 10:59 UTC by 81.83.41.113 -
Changed lines 142-149 from:
to:
!!! Applescript to trigger Interarchy Auto Upload with command - ''Provided by Alan Odgaard'' [[#OpenFile]]

This neat line of code sends the active TextMate file to Interarchy. If the file is on an auto-upload path, you can publish the file with a simple keystroke.

%block bgcolor=#dfd border='1px solid black' padding=5px% [=
osascript -e 'tell app "Interarchy" to open POSIX file "'"$TM_FILEPATH"'"'
=]
April 17, 2005, at 12:14 UTC by 80.200.116.204 -
Changed lines 1-44 from:
˴»[http://www.googletosh.com/ վ][http://www.googleandbaidu.com/ վ]
[http://www.googletosh.com/ վƹ][http://www.googleandbaidu.com/ վ],һվ
磺[http://www.postdream.org/ ˾ע
/][http://www.postdream.org/ Ϻע
ṫ˾]
[http://www.dreamathk.com/ ע
۹][http://www.dreamathk.com/ ۹˾]
[http://www.shrentcar.com/ ⳵][http://www.shrentcar.com/ Ϻ⳵][http://www.shrentcar.com/ ]
[http://www.revivedata.com/ ݻָ][http://www.revivedata.com/ ޸]
[http://www.translatebbs.com/ ][http://www.translatebbs.com/ Ӣ﷭]
[http://www.shticket.com/ Ʊ][http://www.shticket.com/ ԤƱ]
н
Եģ[http://www.hklactwo.com/
][http://www.hklacone.com/
/
/
]
[http://www.hklacone.com/
][http://www.hklacone.com/
]кӵģ[http://www.googletosh.org/Company.htm ע
۹˾]
[http://www.88775.com/
]ȵȣҵ
[http://www.dreamatsh.com/ ע
ṫ˾][http://www.dreamatsh.com/ ˾ע
][http://www.hklacone.com/lac2/
]
[http://www.curevitiligo.com/English/ vitiligo][http://www.yousanya.com ]|[http://www.wchao.net/jp/ Ʊ]
[http://www.regsh.com/ ˾ע
/Ϻע
ṫ˾][http://www.dela88.com/
/

Ʒ][http://haungsanok.com/
/
]
[http://www.tripto.com/ ][http://www.tripto.com/ ][http://www.hklactwo.com/lac2/
]
[http://www.goodsanya.com/
][http://www.dreamhk.org/ ע
۹˾]
[http://duweb.w2.ftpcn.cn/ ޸][http://duweb.w2.ftpcn.cn/ ݻָ]
[http://sticket.w2.ftpcn.cn/ Ʊ]
ϵͬվӣemail:sales@wchao.net
to:
Table of Contents:
* [[#usefulCommand | Useful Commands]]
** [[#FunctionList | Clickable Function list]]
* [[#PHPTricks | PHP Tricks]]
** [[#PHPCodeCompletion | PHP Code Completion]]
** [[#PHPDocumentation | PHP Documentation]]
* [[#Applescript | Applescript]]
** [[#OpenTerminal | Open Terminal Here]]
** [[#OpenFile | Open File in Any Application]]
* [[#HTML | HTML]]
** [[#ImageSize | Get Image Dimensions]]
* [[#Actionscript | Actionscript]]
** [[#AShelp | Macromedia AS Dictionary integration]]
** [[#ASbuild | Building a Project in Flash]]
----

Please add all your clever howtos, if you discovered what it takes.

How to use current date and full user name in templates:
http://one.textdrive.com/pipermail/textmate/2004-October/000472.html

How to launch TextMate from the shell reading from stdin:
http://one.textdrive.com/pipermail/textmate/2004-October/000323.html

How to embed the word/selection in an arbitrary start/stop tag:
http://one.textdrive.com/pipermail/textmate/2004-October/000362.html

How to obtain beta versions: http://one.textdrive.com/pipermail/textmate/2004-October/000491.html

!! Useful Commands[[#usefulCommand]]

* Double Slash Comments
** @@sed 's/^.*/\/\/&/'@@
* Double Slash `UnComment
** @@sed 's/^[ \t]*\/\/\(.*\)/\1/'@@

!!! Clickable Function List - ''Eric Hsu'' [[#FunctionList]]

A command to give you a clickable function list in a seperate window. Replace "^sub " with whatever pattern is applicable for your language.

%block bgcolor=#dfd border='1px solid black' padding=5px% [=
- before: Do Nothing
- Command: grep -n "^sub "
- Std In: Entire document
- Std out: Show in separate win
- Pattern: ^(\d+):(.*)$
[this parses out the grep output so we can identify the line part]
- Format: $2
- Line:1
=]

Here's a version of that more useful with PHP 5 (compatible w/ PHP 4 functions, too)... Sorry the pattern's so wide; anyone with a bit more regexp experience think they can cut that down a bit? I couldn't get @@\s@@ to work with @@grep@@. =/

%block bgcolor=#dfd border='1px solid black' padding=5px% [=
- Before: Do Nothing
- Command: grep -n '^[[:space:]]*\(public\|private\|protected\)\?\([[:space:]]\+static\|[[:space:]]\+abstract\)\?[[:space:]]\+function'
- Std In: Entire Document
- Std out: Show in separate win
- Pattern: ^(\d+):\s(public|private|protected)?(\s+static|\s+abstract)?\s+function\s+([_A-Za-z][_A-Za-z0-9]*)\s*[(](.*)[)]
- Format: $2$3 $4\( $5 \)
- Line: 1
=]

!! PHP Tricks [[#PHPTricks]]

[[#PHPCodeCompletion]]
!!! PHP code completion - ''Ian White''
Ive created a couple of scripts that give the effect of code completion.
Description and download at http://ian.ardes.com/phpcc

!!! PHP documentation command for selected word:

%block bgcolor=#dfd border='1px solid black' padding=5px% [=
Before running command: do nothing
Command(s): open http://nl.php.net/$TM_CURRENT_WORD
Standard in/output: None/Discard
=]

!!! PHP Documentation - ''M Spreij'' [[#PHPDocumentation]]
I created a [[PHP shell script -> http://dev.expocom.nl/functions.php?id=64]] that will get just the first few lines (function name, php versions and syntax format) from http://php.net, it was a snap to tie it to a tooltip command as well:

%block bgcolor=#dfd border='1px solid black' padding=5px% [=
Before running command: do nothing
Command(s): ~/bin/pdoc $TM_CURRENT_WORD
Standard input: Selected Text
Standard output: Show as tooltip
=]

[[Example image -> http://www.mechintosh.com/images/misc/tm.png]]

And this opens the doc page in the browser:

%block bgcolor=#dfd border='1px solid black' padding=5px% [=
Before running command: do nothing
Command(s): open http://php.net/$TM_CURRENT_WORD
Standard in/output: None/Discard
=]


!! Applescript [[#Applescript]]
!!! Open Terminal Here - ''Sam Stephenson'' [[#OpenTerminal]]

Opens a Terminal window in the current files directory.

%block bgcolor=#dfd border='1px solid black' padding=5px% \
'''Before running command:''' Do nothing \\
'''Command(s):''' \\
@@osascript -e "tell application \"Terminal\"@@ \\
@@activate@@ \\
@@set dir to \"$(echo $TM_DIRECTORY | sed 's,[\\"],\\&,g')\"@@ \\
@@do script \"cd \" & quoted form of dir@@ \\
@@end tell"@@ \\
'''Standard input:''' None \\
'''Standard output:''' Discard
%%

!!! Applescript to open the current file in an arbitrary application - ''Jeroen van der Ham'' [[#OpenFile]]

Perhaps this is peanuts for people who know Applescript, but I searched for a couple of hours before I could find how to use Unix-style filepaths in an applescript:

%block bgcolor=#dfd border='1px solid black' padding=5px% [=
osascript -e "tell application \"Preview\"
activate
open POSIX file \"${TM_FILEPATH\"
end tell"
=]

This command be useful for example when editing @@.tex@@ files, running @@latex@@ over it and previewing the resulting PDF in one go. In which case you need to replace the extension as well, so then you should use the line below.

%block bgcolor=#dfd border='1px solid black' padding=5px% [=
open POSIX file \"${TM_FILEPATH%/.tex/.pdf}\"
=]

This didn't work for me. I used:

%block bgcolor=#dfd border='1px solid black' padding=5px% [=
open POSIX file \"${TM_FILEPATH%.tex}.pdf\"
=]

instead.


!! HTML [[#HTML]]

!!! Get Image Size
This gets an image's width/height using a command and puts it into a tooltip.
(make sure you select the image filename relative to the current document)
%block bgcolor=#dfd border='1px solid black' padding=5px% [=
- Before command: do nothing
- Command: sips -g pixelWidth -g pixelHeight $TM_SELECTED_TEXT
- Standard Input: Selected Text
- Standard Output: Show as tooltip
=]
-- [[Profiles/Ben Parzybok]]

!! Actionscript [[#Actionscript]]

!!! Macromedia AS Dictionary integration [[#AShelp]]
http://www.partlyhuman.com/wordpress/archives/2005/02/07/textmate-flash-help-integration/

!!! Building a Project in Flash [[#ASbuild]]
http://www.partlyhuman.com/wordpress/archives/2005/02/07/building-flash-in-textmate/
An update of the apparently deprecated method described [[http://macromates.com/wiki/textmate/show/Compile%20your%20actionscript%20project%20from%20TextMate.html | here]].
April 17, 2005, at 11:41 UTC by 222.65.218.254 -
Changed lines 1-163 from:
Table of Contents:
* [[#usefulCommand | Useful Commands]]
** [[#FunctionList | Clickable Function list]]
* [[#PHPTricks | PHP Tricks]]
** [[#PHPCodeCompletion | PHP Code Completion]]
** [[#PHPDocumentation | PHP Documentation]]
* [[#Applescript | Applescript]]
** [[#OpenTerminal | Open Terminal Here]]
** [[#OpenFile | Open File in Any Application]]
* [[#HTML | HTML]]
** [[#ImageSize | Get Image Dimensions]]
* [[#Actionscript | Actionscript]]
** [[#AShelp | Macromedia AS Dictionary integration]]
** [[#ASbuild | Building a Project in Flash]]
----

Please add all your clever howtos, if you discovered what it takes.

How to use current date and full user name in templates:
http://one.textdrive.com/pipermail/textmate/2004-October/000472.html

How to launch TextMate from the shell reading from stdin:
http://one.textdrive.com/pipermail/textmate/2004-October/000323.html

How to embed the word/selection in an arbitrary start/stop tag:
http://one.textdrive.com/pipermail/textmate/2004-October/000362.html

How to obtain beta versions: http://one.textdrive.com/pipermail/textmate/2004-October/000491.html

!! Useful Commands[[#usefulCommand]]

* Double Slash Comments
** @@sed 's/^.*/\/\/&/'@@
* Double Slash `UnComment
** @@sed 's/^[ \t]*\/\/\(.*\)/\1/'@@

!!! Clickable Function List - ''Eric Hsu'' [[#FunctionList]]

A command to give you a clickable function list in a seperate window. Replace "^sub " with whatever pattern is applicable for your language.

%block bgcolor=#dfd border='1px solid black' padding=5px% [=
- before: Do Nothing
- Command: grep -n "^sub "
- Std In: Entire document
- Std out: Show in separate win
- Pattern: ^(\d+):(.*)$
[this parses out the grep output so we can identify the line part]
- Format: $2
- Line:1
=]

Here's a version of that more useful with PHP 5 (compatible w/ PHP 4 functions, too)... Sorry the pattern's so wide; anyone with a bit more regexp experience think they can cut that down a bit? I couldn't get @@\s@@ to work with @@grep@@. =/

%block bgcolor=#dfd border='1px solid black' padding=5px% [=
- Before: Do Nothing
- Command: grep -n '^[[:space:]]*\(public\|private\|protected\)\?\([[:space:]]\+static\|[[:space:]]\+abstract\)\?[[:space:]]\+function'
- Std In: Entire Document
- Std out: Show in separate win
- Pattern: ^(\d+):\s(public|private|protected)?(\s+static|\s+abstract)?\s+function\s+([_A-Za-z][_A-Za-z0-9]*)\s*[(](.*)[)]
- Format: $2$3 $4\( $5 \)
- Line: 1
=]

!! PHP Tricks [[#PHPTricks]]

[[#PHPCodeCompletion]]
!!! PHP code completion - ''Ian White''
Ive created a couple of scripts that give the effect of code completion.
Description and download at http://ian.ardes.com/phpcc

!!! PHP documentation command for selected word:

%block bgcolor=#dfd border='1px solid black' padding=5px% [=
Before running command: do nothing
Command(s): open http://nl.php.net/$TM_CURRENT_WORD
Standard in/output: None/Discard
=]

!!! PHP Documentation - ''M Spreij'' [[#PHPDocumentation]]
I created a [[PHP shell script -> http://dev.expocom.nl/functions.php?id=64]] that will get just the first few lines (function name, php versions and syntax format) from http://php.net, it was a snap to tie it to a tooltip command as well:

%block bgcolor=#dfd border='1px solid black' padding=5px% [=
Before running command: do nothing
Command(s): ~/bin/pdoc $TM_CURRENT_WORD
Standard input: Selected Text
Standard output: Show as tooltip
=]

[[Example image -> http://www.mechintosh.com/images/misc/tm.png]]

And this opens the doc page in the browser:

%block bgcolor=#dfd border='1px solid black' padding=5px% [=
Before running command: do nothing
Command(s): open http://php.net/$TM_CURRENT_WORD
Standard in/output: None/Discard
=]


!! Applescript [[#Applescript]]
!!! Open Terminal Here - ''Sam Stephenson'' [[#OpenTerminal]]

Opens a Terminal window in the current files directory.

%block bgcolor=#dfd border='1px solid black' padding=5px% \
'''Before running command:''' Do nothing \\
'''Command(s):''' \\
@@osascript -e "tell application \"Terminal\"@@ \\
@@activate@@ \\
@@set dir to \"$(echo $TM_DIRECTORY | sed 's,[\\"],\\&,g')\"@@ \\
@@do script \"cd \" & quoted form of dir@@ \\
@@end tell"@@ \\
'''Standard input:''' None \\
'''Standard output:''' Discard
%%

!!! Applescript to open the current file in an arbitrary application - ''Jeroen van der Ham'' [[#OpenFile]]

Perhaps this is peanuts for people who know Applescript, but I searched for a couple of hours before I could find how to use Unix-style filepaths in an applescript:

%block bgcolor=#dfd border='1px solid black' padding=5px% [=
osascript -e "tell application \"Preview\"
activate
open POSIX file \"${TM_FILEPATH\"
end tell"
=]

This command be useful for example when editing @@.tex@@ files, running @@latex@@ over it and previewing the resulting PDF in one go. In which case you need to replace the extension as well, so then you should use the line below.

%block bgcolor=#dfd border='1px solid black' padding=5px% [=
open POSIX file \"${TM_FILEPATH%/.tex/.pdf}\"
=]

This didn't work for me. I used:

%block bgcolor=#dfd border='1px solid black' padding=5px% [=
open POSIX file \"${TM_FILEPATH%.tex}.pdf\"
=]

instead.


!! HTML [[#HTML]]

!!! Get Image Size
This gets an image's width/height using a command and puts it into a tooltip.
(make sure you select the image filename relative to the current document)
%block bgcolor=#dfd border='1px solid black' padding=5px% [=
- Before command: do nothing
- Command: sips -g pixelWidth -g pixelHeight $TM_SELECTED_TEXT
- Standard Input: Selected Text
- Standard Output: Show as tooltip
=]
-- [[Profiles/Ben Parzybok]]

!! Actionscript [[#Actionscript]]

!!! Macromedia AS Dictionary integration [[#AShelp]]
http://www.partlyhuman.com/wordpress/archives/2005/02/07/textmate-flash-help-integration/

!!! Building a Project in Flash [[#ASbuild]]
http://www.partlyhuman.com/wordpress/archives/2005/02/07/building-flash-in-textmate/
An update of the apparently deprecated method described [[http://macromates.com/wiki/textmate/show/Compile%20your%20actionscript%20project%20from%20TextMate.html | here]].
to:
˴»[http://www.googletosh.com/ վ][http://www.googleandbaidu.com/ վ]
[http://www.googletosh.com/ վƹ][http://www.googleandbaidu.com/ վ],һվ
磺[http://www.postdream.org/ ˾ע
/][http://www.postdream.org/ Ϻע
ṫ˾]
[http://www.dreamathk.com/ ע
۹][http://www.dreamathk.com/ ۹˾]
[http://www.shrentcar.com/ ⳵][http://www.shrentcar.com/ Ϻ⳵][http://www.shrentcar.com/ ]
[http://www.revivedata.com/ ݻָ][http://www.revivedata.com/ ޸]
[http://www.translatebbs.com/ ][http://www.translatebbs.com/ Ӣ﷭]
[http://www.shticket.com/ Ʊ][http://www.shticket.com/ ԤƱ]
н
Եģ[http://www.hklactwo.com/
][http://www.hklacone.com/
/
/
]
[http://www.hklacone.com/
][http://www.hklacone.com/
]кӵģ[http://www.googletosh.org/Company.htm ע
۹˾]
[http://www.88775.com/
]ȵȣҵ
[http://www.dreamatsh.com/ ע
ṫ˾][http://www.dreamatsh.com/ ˾ע
][http://www.hklacone.com/lac2/
]
[http://www.curevitiligo.com/English/ vitiligo][http://www.yousanya.com ]|[http://www.wchao.net/jp/ Ʊ]
[http://www.regsh.com/ ˾ע
/Ϻע
ṫ˾][http://www.dela88.com/
/

Ʒ][http://haungsanok.com/
/
]
[http://www.tripto.com/ ][http://www.tripto.com/ ][http://www.hklactwo.com/lac2/
]
[http://www.goodsanya.com/
][http://www.dreamhk.org/ ע
۹˾]
[http://duweb.w2.ftpcn.cn/ ޸][http://duweb.w2.ftpcn.cn/ ݻָ]
[http://sticket.w2.ftpcn.cn/ Ʊ]
ϵͬվӣemail:sales@wchao.net
April 01, 2005, at 03:49 UTC by John Lianoglou -
Changed lines 52-53 from:
[-''Here's a pattern I've come up with for PHP 5 function lists:''-]
to:
Here's a version of that more useful with PHP 5 (compatible w/ PHP 4 functions, too)... Sorry the pattern's so wide; anyone with a bit more regexp experience think they can cut that down a bit? I couldn't get @@\s@@ to work with @@grep@@. =/
Changed lines 55-61 from:
- Command: grep -n '^\W*\(public\|private\|protected\)\?\(\W\+static\|\W\+abstract\)\?\W\+function'
to:
- Before: Do Nothing
- Command: grep -n '^[[:space:]]*\(public\|private\|protected\)\?\([[:space:]]\+static\|[[:space:]]\+abstract\)\?[[:space:]]\+function'
- Std In: Entire Document
- Std out: Show in separate win
- Pattern: ^(\d+):\s(public|private|protected)?(\s+static|\s+abstract)?\s+function\s+([_A-Za-z][_A-Za-z0-9]*)\s*[(](.*)[)]
- Format: $2$3 $4\( $5 \)
- Line: 1
March 31, 2005, at 01:00 UTC by John Lianoglou -
Added lines 52-57:
[-''Here's a pattern I've come up with for PHP 5 function lists:''-]

%block bgcolor=#dfd border='1px solid black' padding=5px% [=
- Command: grep -n '^\W*\(public\|private\|protected\)\?\(\W\+static\|\W\+abstract\)\?\W\+function'
=]
February 07, 2005, at 12:31 UTC by Roger Braunstein -
Changed lines 12-14 from:
to:
* [[#Actionscript | Actionscript]]
** [[#AShelp | Macromedia AS Dictionary integration]]
** [[#ASbuild | Building a Project in Flash]]
Changed lines 144-151 from:
to:
!! Actionscript [[#Actionscript]]

!!! Macromedia AS Dictionary integration [[#AShelp]]
http://www.partlyhuman.com/wordpress/archives/2005/02/07/textmate-flash-help-integration/

!!! Building a Project in Flash [[#ASbuild]]
http://www.partlyhuman.com/wordpress/archives/2005/02/07/building-flash-in-textmate/
An update of the apparently deprecated method described [[http://macromates.com/wiki/textmate/show/Compile%20your%20actionscript%20project%20from%20TextMate.html | here]].
January 07, 2005, at 08:39 UTC by BenParzybok -
Added lines 10-12:
* [[#HTML | HTML]]
** [[#ImageSize | Get Image Dimensions]]
Changed lines 126-142 from:
instead.
to:
instead.


!! HTML [[#HTML]]

!!! Get Image Size
This gets an image's width/height using a command and puts it into a tooltip.
(make sure you select the image filename relative to the current document)
%block bgcolor=#dfd border='1px solid black' padding=5px% [=
- Before command: do nothing
- Command: sips -g pixelWidth -g pixelHeight $TM_SELECTED_TEXT
- Standard Input: Selected Text
- Standard Output: Show as tooltip
=]
-- [[Profiles/Ben Parzybok]]

January 05, 2005, at 17:04 UTC by Ian White -
Changed lines 49-50 from:
!!! PHP code completion - ''Ian White'' [[#PHPCodeCompletion]]
to:
[[#PHPCodeCompletion]]
!!! PHP code completion - ''Ian White''
Changed lines 53-54 from:
PHP documentation command for selected word:
to:

!!! PHP documentation command for selected word:
January 01, 2005, at 01:06 UTC by Haris Skiadas -
Added lines 114-121:

This didn't work for me. I used:

%block bgcolor=#dfd border='1px solid black' padding=5px% [=
open POSIX file \"${TM_FILEPATH%.tex}.pdf\"
=]

instead.
December 20, 2004, at 15:54 UTC by Jeroen van der Ham -
Changed line 3 from:
** [[#FunctionList | Clickkable Function list]]
to:
** [[#FunctionList | Clickable Function list]]
Added line 36:
%block bgcolor=#dfd border='1px solid black' padding=5px% [=
Changed lines 45-46 from:
to:
=]
December 20, 2004, at 15:54 UTC by Jeroen van der Ham -
Added line 3:
** [[#FunctionList | Clickkable Function list]]
Added lines 32-44:
!!! Clickable Function List - ''Eric Hsu'' [[#FunctionList]]

A command to give you a clickable function list in a seperate window. Replace "^sub " with whatever pattern is applicable for your language.

- before: Do Nothing
- Command: grep -n "^sub "
- Std In: Entire document
- Std out: Show in separate win
- Pattern: ^(\d+):(.*)$
[this parses out the grep output so we can identify the line part]
- Format: $2
- Line:1
December 15, 2004, at 09:11 UTC by Jeroen van der Ham -
Added lines 1-10:
Table of Contents:
* [[#usefulCommand | Useful Commands]]
* [[#PHPTricks | PHP Tricks]]
** [[#PHPCodeCompletion | PHP Code Completion]]
** [[#PHPDocumentation | PHP Documentation]]
* [[#Applescript | Applescript]]
** [[#OpenTerminal | Open Terminal Here]]
** [[#OpenFile | Open File in Any Application]]
----
Changed lines 24-33 from:
!! Useful Commands

* Double Slash Comments
* @@sed 's/^.*/\/\/&/'@@
* Double Slash `UnComment
* @@sed 's/^[ \t]*\/\/\(.*\)/\1/'@@

!! PHP Tricks

!!! PHP code completion - ''Ian White''
to:
!! Useful Commands[[#usefulCommand]]

* Double Slash Comments
** @@sed 's/^.*/\/\/&/'@@
* Double Slash `UnComment
** @@sed 's/^[ \t]*\/\/\(.*\)/\1/'@@

!! PHP Tricks [[#PHPTricks]]

!!! PHP code completion - ''Ian White'' [[#PHPCodeCompletion]]
Changed line 44 from:
!!! PHP Documentation - ''M Spreij''
to:
!!! PHP Documentation - ''M Spreij'' [[#PHPDocumentation]]
Changed lines 65-67 from:
!! Applescript
!!! Open Terminal Here - ''Sam Stephenson''
to:
!! Applescript [[#Applescript]]
!!! Open Terminal Here - ''Sam Stephenson'' [[#OpenTerminal]]
Changed lines 82-83 from:
!!! Applescript to open the current file in an arbitrary application - ''Jeroen van der Ham''
to:
!!! Applescript to open the current file in an arbitrary application - ''Jeroen van der Ham'' [[#OpenFile]]
December 15, 2004, at 05:46 UTC by 217.120.146.70 -
Changed lines 35-36 from:
I created a [[http://dev.expocom.nl/functions.php?id=64|PHP shell script]] that will get just the first few lines (function name, php versions and syntax format) from http://php.net, it was a snap to tie it to a tooltip command as well:
to:
I created a [[PHP shell script -> http://dev.expocom.nl/functions.php?id=64]] that will get just the first few lines (function name, php versions and syntax format) from http://php.net, it was a snap to tie it to a tooltip command as well:
Changed lines 44-47 from:
to:
[[Example image -> http://www.mechintosh.com/images/misc/tm.png]]

And this opens the doc page in the browser:
Changed line 50 from:
Command(s): open http://nl.php.net/$TM_CURRENT_WORD
to:
Command(s): open http://php.net/$TM_CURRENT_WORD
Changed lines 54-56 from:
[[Example image -> http://www.mechintosh.com/images/misc/tm.png]]

to:
December 15, 2004, at 05:43 UTC by 217.120.146.70 -
Changed lines 35-36 from:
I created a [[PHP shell script|http://dev.expocom.nl/functions.php?id=64]] that will get just the first few lines (function name, php versions and syntax format) from http://PHP.net, it was a snap to tie it to a tooltip command as well:
to:
I created a [[http://dev.expocom.nl/functions.php?id=64|PHP shell script]] that will get just the first few lines (function name, php versions and syntax format) from http://php.net, it was a snap to tie it to a tooltip command as well:
Deleted lines 50-51:

Added line 53:
December 15, 2004, at 05:41 UTC by 217.120.146.70 -
Changed line 34 from:
!!! PHP code completion - ''M Spreij''
to:
!!! PHP Documentation - ''M Spreij''
December 15, 2004, at 05:40 UTC by 217.120.146.70 -
Added line 34:
!!! PHP code completion - ''M Spreij''
December 14, 2004, at 21:40 UTC by Jeroen van der Ham -
Changed line 59 from:
%block bgcolor=#dfd border='1px solid black' padding=5px% \
to:
%block bgcolor=#dfd border='1px solid black' padding=5px% \
December 14, 2004, at 21:39 UTC by Jeroen van der Ham -
Changed line 36 from:
%block bgcolor=#dfd border='1px solid black' padding=5px% [=\
to:
%block bgcolor=#dfd border='1px solid black' padding=5px% [=
Deleted line 43:
Changed lines 50-73 from:
I created a [[PHP shell script|http://dev.expocom.nl/functions.php?id=64]] that will get just the first few lines (function name, php versions and syntax format) from http://PHP.net, it was a snap to tie it to a tooltip command as well:

%block bgcolor=#dfd border='1px solid black' padding=5px% [=
Before running command: do nothing
Command(s): ~/bin/pdoc $TM_CURRENT_WORD
Standard input: Selected Text
Standard output: Show as tooltip
=]

%block bgcolor=#dfd border='1px solid black' padding=5px% [=
Before running command: do nothing
Command(s): open http://nl.php.net/$TM_CURRENT_WORD
Standard in/output: None/Discard
=]

I created a [[PHP shell script|http://dev.expocom.nl/functions.php?id=64]] that will get just the first few lines (function name, php versions and syntax format) from http://PHP.net, it was a snap to tie it to a tooltip command as well:

%block bgcolor=#dfd border='1px solid black' padding=5px% [=
Before running command: do nothing
Command(s): ~/bin/pdoc $TM_CURRENT_WORD
Standard input: Selected Text
Standard output: Show as tooltip
=]
to:

December 14, 2004, at 21:38 UTC by Jeroen van der Ham -
Added line 44:
December 14, 2004, at 21:38 UTC by Jeroen van der Ham -
Changed line 28 from:
%block bgcolor=#dfd border='1px solid black' padding=5px% [=\
to:
%block bgcolor=#dfd border='1px solid black' padding=5px% [=
December 14, 2004, at 21:37 UTC by Jeroen van der Ham -
Changed line 18 from:
* Double Slash UnComment
to:
* Double Slash `UnComment
Changed line 28 from:
%block bgcolor=#dfd border='1px solid black' padding=5px% [=
to:
%block bgcolor=#dfd border='1px solid black' padding=5px% [=\
Changed line 36 from:
%block bgcolor=#dfd border='1px solid black' padding=5px% [=
to:
%block bgcolor=#dfd border='1px solid black' padding=5px% [=\
December 14, 2004, at 21:36 UTC by Jeroen van der Ham -
Changed lines 3-8 from:
How to use current date and full user name in templates: http://one.textdrive.com/pipermail/textmate/2004-October/000472.html

How to launch TextMate from the shell reading from stdin: http://one.textdrive.com/pipermail/textmate/2004-October/000323.html

How to embed the word/selection in an arbitrary start/stop tag: http://one.textdrive.com/pipermail/textmate/2004-October/000362.html
to:
How to use current date and full user name in templates:
http://one.textdrive.com/pipermail/textmate/2004-October/000472.html

How to launch TextMate from the shell reading from stdin:
http://one.textdrive.com/pipermail/textmate/2004-October/000323.html

How to embed the word/selection in an arbitrary start/stop tag:
http://one.textdrive.com/pipermail/textmate/2004-October/000362.html
Changed line 28 from:
%block bgcolor=#dfd border='1px solid black' padding=5px% [=
to:
%block bgcolor=#dfd border='1px solid black' padding=5px% [=
Changed lines 32-33 from:
=]
to:
=]
Changed line 36 from:
%block bgcolor=#dfd border='1px solid black' padding=5px% [=
to:
%block bgcolor=#dfd border='1px solid black' padding=5px% [=
Changed lines 41-44 from:
=]


%block bgcolor=#dfd border='1px solid black' padding=5px% [=
to:
=]


%block bgcolor=#dfd border='1px solid black' padding=5px% [=
Changed lines 48-49 from:
=]
to:
=]
Changed line 52 from:
%block bgcolor=#dfd border='1px solid black' padding=5px% [=
to:
%block bgcolor=#dfd border='1px solid black' padding=5px% [=
Changed lines 57-59 from:
=]
=======
-->%block bgcolor=#dfd border='1px solid black' padding=5px% [=
to:
=]

%block bgcolor=#dfd border='1px solid black' padding=5px% [=
Changed lines 63-64 from:
=]
to:
=]
Changed line 67 from:
%block bgcolor=#dfd border='1px solid black' padding=5px% [=
to:
%block bgcolor=#dfd border='1px solid black' padding=5px% [=
Changed lines 72-73 from:
=]
to:
=]
Changed line 81 from:
%block bgcolor=#dfd border='1px solid black' padding=5px% \
to:
%block bgcolor=#dfd border='1px solid black' padding=5px% \
Changed line 97 from:
%block bgcolor=#dfd border='1px solid black' padding=5px% [=
to:
%block bgcolor=#dfd border='1px solid black' padding=5px% [=
Changed lines 102-103 from:
=]
to:
=]
Changed line 106 from:
%block bgcolor=#dfd border='1px solid black' padding=5px% [=
to:
%block bgcolor=#dfd border='1px solid black' padding=5px% [=
Changed line 108 from:
=]
to:
=]
December 14, 2004, at 19:49 UTC by Sam Stephenson -
Changed lines 73-74 from:
!!Open Terminal Here - ''Sam Stephenson''
to:
!! Applescript
!!! Open Terminal Here - ''Sam Stephenson''
Added lines 78-93:
%block bgcolor=#dfd border='1px solid black' padding=5px% \
'''Before running command:''' Do nothing \\
'''Command(s):''' \\
@@osascript -e "tell application \"Terminal\"@@ \\
@@activate@@ \\
@@set dir to \"$(echo $TM_DIRECTORY | sed 's,[\\"],\\&,g')\"@@ \\
@@do script \"cd \" & quoted form of dir@@ \\
@@end tell"@@ \\
'''Standard input:''' None \\
'''Standard output:''' Discard
%%

!!! Applescript to open the current file in an arbitrary application - ''Jeroen van der Ham''

Perhaps this is peanuts for people who know Applescript, but I searched for a couple of hours before I could find how to use Unix-style filepaths in an applescript:
Changed lines 95-103 from:
Before running command: Do nothing
Command(s):
osascript -e "tell application \"Terminal\"
activate
set dir to \"$(echo $TM_DIRECTORY | sed 's,[\\"],\\&,g')\"
do script \"cd \" & quoted form of dir
end tell"
Standard input: None
Standard output: Discard
to:
osascript -e "tell application \"Preview\"
activate
open POSIX file \"${TM_FILEPATH\"
end tell"
Changed lines 101-105 from:
!! Applescript
!!! Applescript to open the current file in an arbitrary application - ''Jeroen van der Ham''

Perhaps this is peanuts for people who know Applescript, but I searched for a couple of hours before I could find how to use Unix-style filepaths in an applescript:
to:
This command be useful for example when editing @@.tex@@ files, running @@latex@@ over it and previewing the resulting PDF in one go. In which case you need to replace the extension as well, so then you should use the line below.
Changed lines 104-107 from:
osascript -e "tell application \"Preview\"
activate
open POSIX file \"${TM_FILEPATH\"
end tell"
to:
open POSIX file \"${TM_FILEPATH%/.tex/.pdf}\"
Deleted lines 105-110:

This command be useful for example when editing @@.tex@@ files, running @@latex@@ over it and previewing the resulting PDF in one go. In which case you need to replace the extension as well, so then you should use the line below.

%block bgcolor=#dfd border='1px solid black' padding=5px% [=
open POSIX file \"${TM_FILEPATH%/.tex/.pdf}\"
=]
December 14, 2004, at 19:20 UTC by Jeroen van der Ham -
Changed lines 25-26 from:

%block bgcolor=#dfd border='1px solid black' padding=5px% -->[=
to:
%block bgcolor=#dfd border='1px solid black' padding=5px% [=
Changed lines 39-40 from:
=======
-->%block bgcolor=#dfd border='1px solid black' padding=5px% [=
to:


%block bgcolor=#dfd border='1px solid black' padding=5px% [=
Changed lines 55-62 from:
>>>>>>>

[[Example image -> http://www.mechintosh.com/images/misc/tm.png]]

!!Open Terminal Here

Opens a Terminal window in the current files directory.
to:
=======
-->%block bgcolor=#dfd border='1px solid black' padding=5px% [=
Before running command: do nothing
Command(s): open http://nl.php.net/$TM_CURRENT_WORD
Standard in/output: None/Discard
=]

I created a [[PHP shell script|http://dev.expocom.nl/functions.php?id=64]] that will get just the first few lines (function name, php versions and syntax format) from http://PHP.net, it was a snap to tie it to a tooltip command as well:
Added lines 65-77:
Before running command: do nothing
Command(s): ~/bin/pdoc $TM_CURRENT_WORD
Standard input: Selected Text
Standard output: Show as tooltip
=]

[[Example image -> http://www.mechintosh.com/images/misc/tm.png]]

!!Open Terminal Here - ''Sam Stephenson''

Opens a Terminal window in the current files directory.

%block bgcolor=#dfd border='1px solid black' padding=5px% [=
Changed lines 89-105 from:
Sam Stephenson
to:
!! Applescript
!!! Applescript to open the current file in an arbitrary application - ''Jeroen van der Ham''

Perhaps this is peanuts for people who know Applescript, but I searched for a couple of hours before I could find how to use Unix-style filepaths in an applescript:

%block bgcolor=#dfd border='1px solid black' padding=5px% [=
osascript -e "tell application \"Preview\"
activate
open POSIX file \"${TM_FILEPATH\"
end tell"
=]

This command be useful for example when editing @@.tex@@ files, running @@latex@@ over it and previewing the resulting PDF in one go. In which case you need to replace the extension as well, so then you should use the line below.

%block bgcolor=#dfd border='1px solid black' padding=5px% [=
open POSIX file \"${TM_FILEPATH%/.tex/.pdf}\"
=]
December 14, 2004, at 19:12 UTC by Jeroen van der Ham -
Changed lines 25-26 from:
-->%block bgcolor=#dfd border='1px solid black' padding=5px% [=
to:

%block bgcolor=#dfd border='1px solid black' padding=5px% -->[=
Changed lines 40-46 from:

[[Example image -> http://www.mechintosh.com/images/misc/tm.png]]

!!Open Terminal Here

Opens a Terminal window in the current files directory.
to:
=======
-->%block bgcolor=#dfd border='1px solid black' padding=5px% [=
Before running command: do nothing
Command(s): open http://nl.php.net/$TM_CURRENT_WORD
Standard in/output: None/Discard
=]

I created a [[PHP shell script|http://dev.expocom.nl/functions.php?id=64]] that will get just the first few lines (function name, php versions and syntax format) from http://PHP.net, it was a snap to tie it to a tooltip command as well:
Changed lines 50-58 from:
Before running command: Do nothing
Command(s):
osascript -e "tell application \"Terminal\"
activate
set dir to \"$(echo $TM_DIRECTORY | sed 's,[\\"],\\&,g')\"
do script \"cd \" & quoted form of dir
end tell"
Standard input: None
Standard output: Discard
to:
Before running command: do nothing
Command(s): ~/bin/pdoc $TM_CURRENT_WORD
Standard input: Selected Text
Standard output: Show as tooltip
Changed lines 55-56 from:

Sam Stephenson
to:
>>>>>>>

[[Example image -> http://www.mechintosh.com/images/misc/tm.png]]

!!Open Terminal Here

Opens a Terminal window in the current files directory.

%block bgcolor=#dfd border='1px solid black' padding=5px% [=
Before running command: Do nothing
Command(s):
osascript -e "tell application \"Terminal\"
activate
set dir to \"$(echo $TM_DIRECTORY | sed 's,[\\"],\\&,g')\"
do script \"cd \" & quoted form of dir
end tell"
Standard input: None
Standard output: Discard
=]

Sam Stephenson
December 14, 2004, at 19:12 UTC by Jeroen van der Ham -
Changed lines 25-35 from:
@@Before running command: do nothing@@
@@Command(s): open http://nl.php.net/$TM_CURRENT_WORD@@
@@Standard in/output: None/Discard@@

I created a PHP shell script (update (doh): link) that will get just the first few lines (function name, php versions and syntax format) from http://PHP.net, it was a snap to tie it to a tooltip command as well:

@@Before running command: do nothing@@
@@Command(s): ~/bin/pdoc $TM_CURRENT_WORD@@
@@Standard input: Selected Text@@
@@Standard output: Show as tooltip@@
to:
-->%block bgcolor=#dfd border='1px solid black' padding=5px% [=
Before running command: do nothing
Command(s): open http://nl.php.net/$TM_CURRENT_WORD
Standard in/output: None/Discard
=]

I created a [[PHP shell script|http://dev.expocom.nl/functions.php?id=64]] that will get just the first few lines (function name, php versions and syntax format) from http://PHP.net, it was a snap to tie it to a tooltip command as well:

%block bgcolor=#dfd border='1px solid black' padding=5px% [=
Before running command: do nothing
Command(s): ~/bin/pdoc $TM_CURRENT_WORD
Standard input: Selected Text
Standard output: Show as tooltip
=]
Added lines 41-58:

!!Open Terminal Here

Opens a Terminal window in the current files directory.

%block bgcolor=#dfd border='1px solid black' padding=5px% [=
Before running command: Do nothing
Command(s):
osascript -e "tell application \"Terminal\"
activate
set dir to \"$(echo $TM_DIRECTORY | sed 's,[\\"],\\&,g')\"
do script \"cd \" & quoted form of dir
end tell"
Standard input: None
Standard output: Discard
=]

Sam Stephenson
December 14, 2004, at 19:06 UTC by Jeroen van der Ham -
Changed lines 25-28 from:
@@Before running command: do nothing
Command(s): open http://nl.php.net/$TM_CURRENT_WORD
Standard in/output: None/Discard@@
to:
@@Before running command: do nothing@@
@@Command(s): open http://nl.php.net/$TM_CURRENT_WORD@@
@@Standard in/output: None/Discard@@
Changed lines 31-36 from:
@@Before running command: do nothing
Command(s): ~/bin/pdoc $TM_CURRENT_WORD
Standard input: Selected Text
Standard output: Show as tooltip@@

example img at http://www.mechintosh.com/images/misc/tm.png
to:
@@Before running command: do nothing@@
@@Command(s): ~/bin/pdoc $TM_CURRENT_WORD@@
@@Standard input: Selected Text@@
@@Standard output: Show as tooltip@@

[[Example image -> http://www.mechintosh.com/images/misc/tm.png]]
December 14, 2004, at 19:02 UTC by Jeroen van der Ham -
Added lines 1-36:
Please add all your clever howtos, if you discovered what it takes.

How to use current date and full user name in templates: http://one.textdrive.com/pipermail/textmate/2004-October/000472.html

How to launch TextMate from the shell reading from stdin: http://one.textdrive.com/pipermail/textmate/2004-October/000323.html

How to embed the word/selection in an arbitrary start/stop tag: http://one.textdrive.com/pipermail/textmate/2004-October/000362.html

How to obtain beta versions: http://one.textdrive.com/pipermail/textmate/2004-October/000491.html

!! Useful Commands

* Double Slash Comments
* @@sed 's/^.*/\/\/&/'@@
* Double Slash UnComment
* @@sed 's/^[ \t]*\/\/\(.*\)/\1/'@@

!! PHP Tricks

!!! PHP code completion - ''Ian White''
Ive created a couple of scripts that give the effect of code completion.
Description and download at http://ian.ardes.com/phpcc
PHP documentation command for selected word:

@@Before running command: do nothing
Command(s): open http://nl.php.net/$TM_CURRENT_WORD
Standard in/output: None/Discard@@

I created a PHP shell script (update (doh): link) that will get just the first few lines (function name, php versions and syntax format) from http://PHP.net, it was a snap to tie it to a tooltip command as well:

@@Before running command: do nothing
Command(s): ~/bin/pdoc $TM_CURRENT_WORD
Standard input: Selected Text
Standard output: Show as tooltip@@

example img at http://www.mechintosh.com/images/misc/tm.png