The -w wait mode now switches back to the Terminal program upon
window close. You can set which program (or no switching) by editing
the OPENTERMAPP variable. E.g. I have it set to iTerm, because I like
it better!
http://macromates.com/svn/Bundles/trunk/Scripts/tm
- Eric
--
Eric Hsu, Assistant Professor of Mathematics
San Francisco State University
erichsu(a)math.sfsu.edu
http://math.sfsu.edu/hsu
Okay, somebody had the brilliant and easy idea of adding a little
'Hit RETURN' kludge to allow use of TM with svn and other external
editing. So I tweaked the command line tool I posted and added a
better help listing and a -w to have it block until the user hits
RETURN.
I have used it successfully to check it into SVN and use TM to write
the comment. The little pleasures! :)
You can get it at
<http://macromates.com/svn/Bundles/trunk/Scripts/tm>. If you need
this tool, you don't need my help installing it...
best, Eric
--
Eric Hsu, Assistant Professor of Mathematics
San Francisco State University
erichsu(a)math.sfsu.edu
http://math.sfsu.edu/hsu
1. I have appended a shell script that launches TM and allows piped
input. I did not write the script; in fact, I merely found it in my
~/bin directory and thought that it came with the standard TM
install. The -c option lets you create a new file.
It does lack the crucial 'don't quit until editing is done' feature.
Here are three kludges I can think of to get that feature. Given a
-wait flag:
a. add a block at the end of the script that creates a $TM_FILE.lock
in the same directory and checks every N seconds for the .lock file.
When it's gone, quit the script. Then create a command that saves
current file and deletes the .lock file. Finally, write a little
macro that saves, closes the window and runs the 'delete .lock'
command.
In a future version of TM that triggers scripts/commands on events,
one can avoid the command and macro, and have 'Close Window' trigger
the deletion of the lock file.
b. have the shell script loop and check for changes to the
modification date on the file. Unfortunately, that means it will quit
on the first save. But you don't need any fiddling with macros and
commands.
c. call the Textmate Service from a (different) shell script. The TM
Service definitely blocks whatever app calls it. In other contexts
this might be a bug, but here it's great. However, I don't know how
to pipe text to a Cocoa Service from the command line. This may be
rather hard. Any ideas?
- Eric
---
#!/bin/sh
# Originally written by Rick Gardner (rick.gardner(a)mac.com)
# and Kevin Ballard (kevin(a)sb.org)
# Modified to work with TextMate by Andrew Ellis aellis(a)gmx.net
# 10-11-2004
OPEN="open -a TextMate"
CREATE="touch"
USAGE="usage: tm [-ch] filename [filename ...]"
CREATE_FILE=0
while getopts ch FLAG; do
case $FLAG in
c) CREATE_FILE=1;;
h|\?) echo $USAGE; exit 1;;
esac
done
shift $(($OPTIND - 1))
# are we dealing with a filename or are we using stdin?
if (( $# == 0 )); then
if [ ! -t 0 ]; then
exec 6<&0
exec 7>&1
prefix=/tmp/tm
suffix=$(date +%s) # The "+%s" option to 'date' is
GNU-specific.
filename=$prefix.$suffix
$CREATE $filename
exec > $filename
while read a1
do
echo $a1
done
open -a TextMate.app $filename
exec 0<&6 6<&-
exec 1<&7 7<&-
else
if [ ! -z ${1} ]; then
$CREATE ${1}
$OPEN ${1}
else
$OPEN
fi
fi
else
# iterate over the files
for filename; do
# create the file if requested
if (( $CREATE_FILE )); then
if [[ -f $filename ]]; then
echo "File \`$filename' already exists."
fi
$CREATE $filename
fi
if [[ -e $filename ]]; then # now also
opens directories
$OPEN "$filename"
else
echo "File \`$filename' does not exist."
fi
done
fi
Hi guys,
is there a way to split a page in 2 views? Nice, when working with a
lot of properties in a class. So I
can have all the properties show up in one view, while working on other
parts in the class. It would
also be nice to have a split view with two different files. Like
classfile1 on top and classfile2 on the
bottom.
Best Regards,
Andy
Hi
Is there any way, or will there be, to browse the files from the HD?
Like as in the projects drawer, except - being able to browse your HD. I
was a long time user of jEdit and found this option most useful.
Thank you
Eoghan
This gets more interesting once we have a way to direct HTML to the
preview window. Another thing that would be nice: command execution
from URLs, which would allow the references to other man pages to work.
But there are -- of course -- security implications to that feature.
Perhaps if it only works in the preview window, not system-wide.
ruby -e "
def error( message )
%x{osascript <<END
tell application \"SystemUIServer\"
activate
display dialog \"#{message}\"
end tell
END
}
end
def ask(question, answer = '$TM_SELECTED_TEXT')
%x{osascript <<END
tell application \"SystemUIServer\"
activate
display dialog \"#{question}\" default answer \"#{answer}\"
set answername to text returned of the result
do shell script (\"/bin/echo \" & answername)
end tell
END}
end
error('Xcode tools must be installed to view man pages') if not
File.exist?('/Library/Application Support/Apple/Developer
Tools/Plug-ins/DocViewerPlugIn.xcplugin/Contents/Resources/rman')
name = ask('Display man page for which command?')
name.chomp!
temptemp = %Q{/tmp/tmp.#{name}.`whoami`.TMmantemp}
temphtml = %Q{/tmp/tmp.#{name}.`whoami`.html}
%x{man #{name} > #{temptemp}}
# generate HTML and open it if successfully found the entry
if not \$?.success? then
# puts 'No manual entry for ' + name
%x{open -a TextMate &} # switch back to TextMate
else
%x{cat #{temptemp} | \"/Library/Application Support/Apple/Developer
Tools/Plug-ins/DocViewerPlugIn.xcplugin/Contents/Resources/rman\"
-fHTML > #{temphtml}}
%x{open #{temphtml}}
end
"
On Jan 13, 2005, Allan Odgaard wrote:
> It's really difficult to say. I have a few things that needs to be
> done before I will go into the input stuff, and these are already
> taking far longer than predicted. And the fix itself I am not sure
> either how long will take -- the best I can do is probably to say,
> don't expect it before at least in 4-6 weeks.
Thanks for your candid reply. I'll work around the problem and look
forward to the fix.
Jonathon
Hi, I'm currently rewritiing the php code completion thingy, and I'd
like it to be scope sensitive.
To find the scope at the cursor I can use the file as stdin, and work
it out myself. But it struck me that I'd be able to work some things
out based on the current pattern applications (like 'Embedded PHP',
and being in quotes). So a couple of questions.
* could we have a variable $TM_PATTERN_NAME which gives the current
pattern name?
* would there be a way to access patterns names 'higher up'? (like
'Embedded PHP')?
I'm wanting to figure out the scope because I'm implementing scope
sensitive completion, including completions based on your own code.
Any comments, advice, much appreciated.
Ian White