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
Having just returned to the Macintosh after eight years of using
Windows (and TextPad), one of the first applications I installed was
TextMate. Twenty minutes later, when I'd piped my first text through
markdown.pl and created my first tab-activated snippets, I was already
happy to pay the license fee.
However, I then found it wasn't possible to enter Japanese text. The
list archives revealed that Kazuo Saito had already raised this issue
(http://one.textdrive.com/pipermail/textmate/2004-December/001824.html)
and that Allan Odgaard had promised a fix:
> I can't give an ETA on when this will be fixed, but I can imagine it's
> frustrating for those who rely on these input methods, so I'll try not
> to have “the fix” pending for too long.
I appreciate that perhaps only a tiny minority of TextMate users need
to work with Asian languages but was hoping that it might be possible
to give an approximate ETA on when this will be fixed. I really don't
want to waste time looking for an alternative to TextMate.
Thanks,
Jonathon Delacour
Just something I ran into today, which I just assumed to be there until I
wanted to use it: search direction option :)
Jeroen.
--
"We apologize for the inconvenience"
Emulate the CodeWarrior/Xcode Open Quickly feature, but open all
matches instead of just the first one. (NSAttributedString, I'm looking
at you.)
####
find /usr/include
/System/Library/Frameworks/ApplicationServices.framework
/System/Library/Frameworks/AppKit.framework
/System/Library/Frameworks/Foundation.framework
/System/Library/Frameworks/Kernel.framework -name `osascript -e "tell
application \"SystemUIServer\"
activate
display dialog \"Find and open which header?\" default answer
\"$TM_SELECTED_TEXT\"
set headername to text returned of the result
do shell script (\"/bin/echo \" & headername & \"*\")
end tell"` -print -exec open -a TextMate {} \; &
####
A refined version of this may show up in the C bundle soon. Meanwhile,
feedback is welcome.
Have fun,
Chris
hi,
some people on the list talked about the icon and it seemed they
didn't like it very much. i dont hate the old icon but it also doesnt
impress me every time i see it, so over the weekend i had too much
freetime and fired up inkscape to play around a bit. here is the
result, i would like to hear some opinions how you like it or not.
its inspired a bit by subethaedits icon and by the color-circle one
posted here on the list and so i filled it purple to fit the gap. :)
--
Torsten Becker
Hi,
I'm new to the list, so please forgive me, if this has being asked
before.
Is it possible to change the tab behavior of TextMate? For example I
find
it strange that single line intending to the right works correctly
(using tabs),
but if you try to tab back to the left site, it is using spaces instead
of tabs.
It would also be great to change the behavior of multi line tabbing.
I'm so used to use the
tab key to intend to the right and "apple key" together with the tab
key to move lines to the
left. But if I do that, the lines I would like to intend, are deleted.
(I hope you understand what I mean.. sorry for my english)
Other then that I really like TextMate.
Kind Regards,
Andy
Switzerland
hi folks,
Another tip I thought I'd share. I often have situations where I
have to discard all lines in a file that start with a number, or
other cleanup tasks like that. Now, you can use TM's Text>Filter
Through Command... and then use grep or grep -v. But I have a hard
time remembering grep's regexp format. It's already all I can do to
remember TM's and Perl's.
So I wanted to write a command to pop up a GUI input field so I could
enter in a Perl regexp for lines to match with two buttons so I could
either Keep only the matching lines or Discard the matching lines.
So what I did was toss together a quick script in Perl and use
CocoaDialog as a front-end. To use this, you need to download
CocoaDialog from <http://cocoadialog.sourceforge.net/download.html>,
and put it in /Applications. (If you don't like that place, change
the path in the script.)
If you don't have a need for this script, you still might be able to
get some mileage out of CocoaDialog. It is a simple way to get GUI
onto any script that talks to the command-line. It has a number of
different window formats. Pashua is neat, but it requires use-ing a
module, and Platypus is more for creating drag-and-drop things.
good luck, Eric
---
TM Command.
Before: nothing
Command:
my$CD="/Applications/CocoaDialog.app/Contents/MacOS/CocoaDialog";my$rv=`$CD
inputbox --title "Filter with Regexp" --no-newline \\
--informative-text "Filter lines matching this Perl regular
expression:" \\ --text "" \\ --button1 "Keep" --button2
"Discard" \\ --width
500`;my($button_rv,$term)=split/\n/,$rv,2;while(<STDIN>){if($button_rv==2){unless(/$term/){print;}}elsif($button_rv==1){if(/$term/){print;}}}
Stdin: selected
Stdout: replace selected
--
Eric Hsu, Assistant Professor of Mathematics
San Francisco State University
erichsu(a)math.sfsu.edu
http://math.sfsu.edu/hsu
howdy,
there is an option to 'Highlight Current Line' in the preferences; is
there anyway to control the color of that line? maybe through the
syntax highlighting files? thanx in advance...
- jamal
I posted another set of icons to the wiki today, but I'll announce it
here. They are more in line (I think) with aqua-style editor icons
(pages and pen), and they use a lot of ideas garnered from the list
archives. There are six colors in the disk image, so hopefully you will
find one you like, and they all have been designed to degrade
gracefully (48 is less detailed so it's not burry and 32 and 16 are
even more so). I would appreciate any feedback/comments etc.
preview: http://www.eight7.com/repository/tmicon_preview.png
icons: http://www.eight7.com/repository/tmicons.dmg.gz
Thanks all!
Jonathan Raphaelson
University of Colorado at Boulder
--
Home: 303-469-3442
Cell: 720-937-4372
jonathan.raphaelson(a)colorado.edu
jonraphaelson(a)gmail.com
>If using LaTeXTidy.pl and your LaTex Tidy bundle command, were should
>LaTeXTidy.pl be placed. I tried usr/local/bin but that did not work.
>Should I place it inside the bundle itself.
First, make sure it's set to execute (chmod +x LaTeXTidy.pl). Then
either place it in your PATH and call it as LaTeXTidy.pl or put it
somewhere you like, e.g. /usr/local/bin/LaTeXTidy.pl and call it with
its full path in the command. I hope that works!
If you put it in the same bundle as the command, then call it with
wither the full path if you know it, or with
"$TM_BUNDLE_PATH"/LaTeXTidy.pl if you think you might move it someday.
Good luck, Eric
ps. Backup your documents! Check! This works for me, but you should
be cautious.
I'd like to play around a bit with an alternative light-on-dark color
scheme for my bundles, but, in the same way that I can't draw a
straight line with a ruler (but can appreciate architecture) I am
completely inept at picking text colors that have high contrast and
look good (but I know them when I see them).
I know someone (or someones) whipped up a C bundle with a light-on-dark
scheme, but I can't seem to find it anywhere. I thought I might start
by looking at that, but what might be better is if someone could point
me to a resource that had examples of high-contrast color schemes for
text highlighting. :-)
Anyone?
Thanks,
B
--
__ ____
/ / / __/ Brian Lalor
/ _ \/__ \ blalor(a)bravo5.org
/_.__/____/ http://bravo5.org/
Here is a little command I've written (as usual, a wrapper around a
Perl script), which naively tries to indent your LaTeX file
intelligently. If it succeeds, there are two good side effects.
First, your file looks nicer. Second, your file foldings work
correctly, as TM is cued by the indentation.
Good luck. Check the file, if you use it. It works for me, your
mileage may vary.
I've appended the one-liner version. Since it is a blob of line
noise, I also have a link to the latest version of the uncompressed
Perl, which is at
<http://anon:anon@macromates.com/svn/Bundles/trunk/Latex.tmbundle/LaTeXTidy.…>
You can put that somewhere and write a command to call it instead.
I suspect anyone with issues with the folding could customize this
script for their language if necessary. I know PerlTidy and HTMLTidy
exist. I couldn't find a TeXTidy, so I wrote this last year...
- Eric
--
Before: Nothing
STDIN: Entire
STDOUT: Replace doc
Command:
perl -e 'my$in;while(<STDIN>){$in.=$_;}my@keywords=qw( appendix
author bibliography bigskip chapter date def document
evensidemargin font headheight headsep include index make new
noindent oddsidemargin page paragraph part ragged renew
section subsection subsubsection subsubsubsection table
textheight textwidth title topmargin use
vfil);$in=~s/\%(.*?)\n/\n\n\%$1\n\n/g;my@pieces=split(/\n\s*\n/,$in);my$string,$keyword;foreach(@pieces){if(/^\s*\%/){$string.=$_."\n";next;}s/\s+/
/g;foreach$keyword(@keywords){s/(\\$keyword)/\n$1/g;}s/([^\\]\%)/\n$1/g;s/(\\begin\{)(.*?)(\})/\n$1$2$3\n/g;s/(\\end\{)(.*?)(\})/\n$1$2$3\n/g;s/(\\item)(.*?)(\\item)/$1$2\n$3/g;s/(\\item)/\n$1/g;s/[^\\](\\\[)/\n$1/g;s/(\\\])/$1\n/g;s/(\\\\)\s/$1\n/g;s/(\\\\\[)(.*?)(\])\s/$1$2$3\n/g;s/\n\s*\n/\n/g;s/^\n//;chomp;$string.=$_."\n\n";}$string=~s/\n\s+\n/\n\n/g;$string=~s/(\%[^\n]*)(\\)(end)/$1$2\{\n\n\n\}$3/g;$string=~s/(\%[^\n]*)(\\)(begin)/$1$2\{\n\n\n\}$3/g;$string=~s/(\\end)/\[\n\n\n\]$1/g;$string=~s/(\\begin)/\[\n\n\n\]$1/g;@pieces=split(/\[\n\n\n\]/,$string);my$indent=1;my@lines;my$piece,$i;$string="";foreach$piece((a)pieces){$piece=~s/\{\n\n\n\}//g;$piece=~/^\\(.*?)\{/;if(lc($1)eq"begin"){$indent++;}else{$indent--;}@lines=split(/\n/,$piece);foreach(@lines){s/^\s+//;if(/^\\begin/i){for($i=1;$i<=$indent-1;$i++){$string.="\t";}}else{for($i=1;$i<=$indent;$i++){$string.="\t";}}$string.=$_."\n";}}print$string;'
I love the new mode-based menu interface for macros/snippets/commands.
What I'd really love is if I could control which mode menu they show
up in.
For example, I've made a couple of commands that are related to HTML.
However, since I've made them myself, they show up under the "Custom"
menu, when I'd really like them to be under "HTML". Maybe, like with
the syntax files, a "mode" key could be added to the
macros/snippets/commands plist files where I could specify which mode
they should be a part of?
What do you think? Thanks much.
Wow--I use TextPad daily on my PC at work and always wished there was a
text editor like it for the Mac where I could easily switch between
documents with tabs. And the ability to call a shell script to do a
word count or any other UNIX command and have the output appear as a
tooltip, new window, or whatever you want--brilliant, and really easy
to use. This is probably the first time I've wished TextPad could do
some things a Mac editor can do, and not vice versa.
There's only one seemingly minor thing that's keeping me from buying
TextMate right now and retiring Tex-Edit Plus--TextMate's auto-identing
feature, where if I have a paragraph of text (not code), it
automatically inserts a tab on the next line when I hit return. This
drives me nuts because while I use my Mac editor for HTML at times, I
mainly use it to write documents that have normal indented paragraphs
of text. At the end of a paragraph in a word processor or email
program I'm conditioned to hit return, then hit tab for the next
paragraph--so having TextMate indent the next paragraph automatically
just means I end up with two tabs.
Does anyone know if there's a way to turn off auto-indenting of new
lines, or is that a feature being considered for a future release? If
there is a way to turn that off and I just can't find it, I apologize
for being an idiot in advance...anyway, thanks to the developer for
creating this, keep up the good work,
-Brian
Is it possible to close files that are open in tabs that are not
visible, i.e., located in the tab overflow without disturbing tabbed
files that are visible?