With the holidays fast approaching and people drifting away from their
desks to do far more entertaining things than write code all day, I
though this was an appropriate time to:
a) wish everyone a very happy Christmas time, if they celebrate the
festival or not ;)
b) offer my thanks again to Allan for providing us with such a great
product. I spend all day, every day working with TextMate and it's the
first time I've actually felt 'at home' coding on the Mac since
switching last January.
That's all really :)
drew.
I'd like to make a bundle with PL/SQL syntax (didn't look like anyone
did that yet), but I don't see how to specify pairs of folding markers.
Here's an example of what's wrong:
PropertyList-Old.plist has these lines:
foldingStartMarker = "(\\{|\\()";
foldingStopMarker = "(\\}|\\))";
But what causes folds on bad blocks like this:
{ # curly brace
) # parenthesis
I'd like to do blocks like these:
IS -> END;
IF -> END IF;
( -> )
etc.
Possible? I see "pairs" of other things are being handled
(e.g.highlightPairs), perhaps we could do this too!
prl
A while back I posted about the possibility of having a history list
for tabs so that you could use a keyboard shortcut to quickly switch to
the last file you were editing. The resolution proposed was to use
drag sorting to locate the files next to each other, and then use tab
navigation to switch back and forth. With only 3 or 4 visible tabs and
many files open, most of my open files are pushed off the tab bar. Can
you drag sort items if they are not currently visible as a tab?
I still think my history list idea has merit. Maybe everyone else is
far more organized, but I've basically devolved to using the mouse and
the project drawer to switch files -- unless I know I am going to be
editing two files side by side for a while, in which case I will close
one -- switch to the other, then open the first one again so that I
know they are side by side.
I realized that this style of working is essentially what I would like
out of the History List that I proposed. In other words, if you
completely ignore the tab bar as a traditional tab bar, it would
function exactly like the history list if -- when switching to a file
from the project drawer, the file acts as if it was not open, and
appears as a tab to the right of the currently open tab.
I fear I did not explain that well, but the idea is simple. When
selecting a file for edit, first close the file, then open it (or
behave as if this was done). If the file is selected from the tab bar,
then leave the behavior as it is. With this behavior, the tab bar
would become a history list, and it would be simple to swap between
files using the already existing tab navigation shortcuts.
Is anyone else overwhelmed by the tab navigation as it stands? This
metaphor works great for something like browsing -- because I can open
up a new window if I have too many tabs already open in the current
window. I hate to keep bringing up emacs-isms, but the switch buffer
commands are very powerful (switch to last buffer, or switch to buffer
by using filename completion). Combine the project drawer with some
sort of history navigation, and I would be very happy.
Thanks,
Wayne
hi folks,
I am startled but gratified at the response to the Un/Comment hack.
I added a number of fixes and options people have been asking for and
packaged it up into a .tmbundle so you don't have to copy in the
hideous Perl 1-liner (but you can... attached below). In the bundle,
I also included the source code, which is released as Niceware.
That's like the Perl Artistic License, except that you have to be
nice to me when you criticize the code.
The bundle lives at <http://math.sfsu.edu/hsu/textmate>.
Changes
- I added some options. To invoke them, put them on the command line, e.g.
perl -e '...' "$TM_FILEPATH" first-column comment .tex
- so if you want separate comment/uncomment, make two commands with
one option 'comment' and the other 'uncomment'
- I added a bunch of filetype endings, including the ones in Chris
T's beautiful Ruby script.
- fixed Ollivier Robert's newline bug
- Drew McLellan: I added CSS, but sadly, I can only comment each
line, not the whole thing. I hope that is still useable.
Options
# 'first-column' puts the first comment marker at the line start
# 'comment' always comments (for people who want the smartness, but
not the toggleness)
# 'uncomment' always uncomments. If you foolishly use both comment
and this, comment wins.
# 'comment-whitespace' comments whitespace which we normally skip.
# '.tex' will force the use of TeX style comments. You can substitute
your favorite ending, like '.java' or '.pl'. The leading dot is
important. Last type listed wins.
# 'toggle' changes the comment status line by line. Normally, the
whole thing is a block.
best wishes, Eric
---
If you install the thing as a tmbundle, you can also install it as a command as
Before: do nothing
Command:
~/Library/Application\
Support/TextMate/Bundles/UnComment.tmbundle/comment-toggle.pl
"$TM_FILEPATH"
STDIN: Selected
STDOUT: Replace Selected
To install it as a command as a one-liner, with no path issues:
Before: do nothing
Command:
perl -e
'$markers={"pl,pm,rb"=>["#",""],"plist,c,css,m+h,cp,cpp,h,p,pas,js,htc,c++,h++"=>["/*","*/","//",""],"java,cc,mm"=>["//","","/*","*/"],"html,htm,xml"=>["<!--","-->"],"bib,ltx,tex,ps,eps"=>["%",""],"php"=>["#","","/*","*/","<!--","-->","//",""],"mli,ml,mll,mly"=>["(*","*)"],"script,adb,ads,sql,ddl,dml"=>["--",""],"f,f77"=>["C
",""],"inf,f90"=>["!",""],};$tab=4;while(($k,$v)=each(%$markers)){foreach(split(/\s*,\s*/,$k)){$c{"$_"}=$v;}}$_=shift@ARGV;($type)=/\.([^.]*)$/;foreach$option(@ARGV){if($option=~/^\.(.*)$/){$type=$1;}$opt->{$option}++;}unless($c{"$type"}){$type="pl";}($start,$finish,@etc)=@{$c{$type}};$isntfirst=0;while(<STDIN>){push@in,$_;($indent)=/^([
\t]*)/;$indentl=0;foreach$j(1..(length($indent))){$ch=substr($indent,$j-1,1);if($ch
eq"
"){$indentl++;}else{unless($indentl%$tab){$indentl+=$tab;}else{$indentl+=$indentl%$tab;}}}unless($isntfirst){$indentmin=$indent;$indentminl=$indentl;$isntfirst++;}else{if($indentl<$indentminl||$indent
eq""){$indentmin=$indent;$indentminl=$indentl;}}}$isntfirst=0;foreach(@in){$lineend="";if($opt->{"toggle"}){$iscomment=$isfirstofpair=$isntfirst=0;}if(chomp){$lineend="\n";}unless(/\S/){unless($opt->{"comment-whitespace"}){$out.=$_."\n";next;}}unless($isntfirst){$isntfirst=1;foreach$delimiter(@{$c{"$type"}}){$isfirstofpair=1-$isfirstofpair;$delimiterq=quotemeta($delimiter);if($isfirstofpair){if(/^\s*$delimiterq/){$iscomment=1;$start=$delimiter;$startq=$delimiterq;}}elsif($iscomment){$finish=$delimiter;$finishq=$delimiterq;last;}}}if($opt->{"uncomment"}){$iscomment=1;}if($opt->{"comment"}){$iscomment=0;}if($iscomment){s/^(\s*)$startq(\
)?/$1/;s/(\
)?$finishq(\s*)$/$1/;$out.=$_.$lineend;}else{if($opt->{"first-column"}){$out.=$start;unless($indentmin){$out.="
";}$out.="$_";if($finish){$out.="
".$finish;}$out.=$lineend;}else{s/^$indentmin//;$out.=$indentmin.$start."
$_";if($finish){$out.=" ".$finish;}$out.=$lineend;}}}print$out;'
"$TM_FILEPATH"
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
Similar to other commands that ship with TM, but escapes spaces for the
URL. There is probably a better way to do this, but this works.
Before running command: Do nothing
Command: open http://dev.mysql.com/doc/mysql/search.php?q=`echo
$TM_SELECTED_TEXT | tr " " "+"`
Standard Input: None
Standard Output: Discard
Enjoy and share your improvements please.
TextMate 1.0.2 writes stuff like this into my console whenever I close
a document window:
2004-12-22 14:31:27.473 TextMate[590] Another workaround for GCC
Any comments on what that's about?
I'm trying to get the ruby version of the (Un)comment command running on
my box, and I'm getting the following error:
/Users/wneuman/Library/Dev/TextMate/comment.rb:1: undefined method
`extname' for File:Class (NameError)
You say that the script requires Ruby 1.8, and I should be fine there as
I've got 1.8.1 installed...
Of course, the amount of Ruby I know would fit handily in my back pocket
-- even if I had stuffed my back pocket full of marbles. handkercheifs,
and gum wrappers beforehand, so I might just be doing something stupid
here. Any ideas on how to fix this?
William D. Neumann
---
"There's just so many extra children, we could just feed the
children to these tigers. We don't need them, we're not doing
anything with them.
Tigers are noble and sleek; children are loud and messy."
-- Neko Case
Think of XML as Lisp for COBOL programmers.
-- Tony-A (some guy on /.)
Hi,
Here's another feature request: Could you make selecting newline
characters a bit easier?
At the moment it is virtually impossible drag-select some text and the
newline character of a line that is followed by a non-empty line.
For an example of how it could be done better is TextEdit. If you select
a text there and drag a distance past the newline character, the newline
character is also included.
Thanks, Jeroen.
An improvement on my earlier post.
Now you can just execute a portion of your sql the whole thing and jump
to errors:
Before running command: Do nothing
Command: [your path to mysql if not in bash's path environment
variable]/mysql -u[your username here] -p[your password here]
Standard Input: Selected Text or Entire Document
Standard Output: Show in separate window
Pattern: ERROR (\d+) at line (\d+): (.*)
Format String: $3
Line: 2
Here is a command that will compile and jump to the line of the file
with the error:
Before running command: Do nothing
Command: cd [directory where build.xml is located]; ant [your target to
build source];
Standard Input: None
Standard Output: Show in separate window
Pattern: .*/(\w*.java):(\d+):(.*)
Format String: $1 $2 $3
File register: 1 Line: 2
Someone can improve on this to get the column and more error
information too. That would be nice.