[TxMt] Clickable URLs in text files
Eric Hsu
erichsu at math.sfsu.edu
Mon May 23 19:31:33 UTC 2005
> When I go through inbox.txt, I would like
> to just hit a key combination when the cursor is on the URL and have
> it send to my browser or my mail program.
I couldn't resist the challenge of trying to hack this during a meeting.
Save: Nothing.
Command:
perl -e '$line=$ENV{"TM_CURRENT_LINE"};$col=$ENV{"TM_COLUMN_NUMBER"};
$a=substr($line,0,$col);substr($line,0,$col)="";$a=reverse$a;$a=~/
(.*?)\s/g;$url1=$1;$url1=$a unless($url1);$url1=reverse$url1;$line=~/
(.*?)\s/g;$url2=$1;$url2=$line unless($url1);print"$url1$url2";' |
xargs open
Input: Selected Text
Output: Discard
Works for me, but requires a full URL, so http://google.com works,
but not google.com. If there's interest it could be easily tweaked to
add 'auto http://'...
best, Eric
---
Eric Hsu, Assistant Professor of Mathematics
San Francisco State University
erichsu at math.sfsu.edu
http://math.sfsu.edu/hsu
More information about the textmate
mailing list