[TxMt] Feature request: "see" like SubEthaEdit

otheraccount at verizon.net otheraccount at verizon.net
Fri Jan 14 21:08:51 UTC 2005


> and there is the 'wait' option, which causes the bbedit command-line 
> program to wait to exit until the file is closed. This is necessary if 
> you want to define bbedit as your EDITOR environment variable and have 
> it work for pine, crontab, etc.

It's actually possible to use TM as your bash editor with a little 
fiddling... Set the EDITOR variable to the location of the following 
script, make it executable, and there you are. Works for me, in any 
case.

Marcin


-------------

#!/bin/sh

##
##  This script makes it possible to use TextMate as the editor for the 
fc
##  command, which allows you to edit previous commands in bash, and 
can be
##  invoked on the curent command via ^x^e.
##

tempfile="$1"
tempfileBN=`basename "$tempfile"`
TMwindowname="Editing from the Command Line..."

# add 'sh' as extension of temp file generated by bash so TM knows it's 
a
# shell file:
mv "$tempfile" "$tempfile.sh"

open -a TextMate "$tempfile.sh" # open the temp file containining the 
command

# set name of TM window and get its id:
osascript -e 'tell app "TextMate.app" to set name of front window to 
"'"$TMwindowname"'"'
TMwindowid=`osascript -e 'tell app "TextMate.app" to return id of front 
window'`

# wait until done editing the temp file:
while [[ `osascript -e 'tell app "TextMate.app" to return name of every 
window whose id is '"$TMwindowid"` != "" ]]; do
         sleep 0 # set this to something else if there's some need to
done

# remove added 'sh' extension from tempfile:
mv "$tempfile.sh" "$tempfile"

osascript -e 'tell app "Terminal" to activate'




More information about the textmate mailing list