I don't speak any scripting language so I was hoping you all could
help me out with two simple commands.
1. Take the current line number, divide my 38 and display the result
as a tooltip that reads: Aprox. Page-Count for Current Line: XX
2. Take the total number of lines in the document, divide my 38 and
display the result as a tooltip that reads: Aprox. Page-Count for
Document: XX
Thanks in advance!
—oliver
> This should do what you need:
>
> npp=38
> res=$(echo `wc -l`)
> pretty () { rev <<<$1|perl -pe 's/(\d{3})(?=.)/$1,/g'|rev; }
> total=$(pretty $(cut <<<$res -d\ -f1))
> php -r "echo ceil($TM_LINE_NUMBER/$npp).'/'.ceil($total/$npp);"
I get the following error:
> Warning: Wrong parameter count for ceil() in Command line code on line 1 58/
I put together a simple bundle for editing Greasemonkey scripts:
http://adamv.com/dev/textmate/greasemonkey
The page documents the new scopes and snippets.
Not a lot to it, but editing a Greasemonkey script is mostly just
editing Javascript.
I can put it in the repository if anyone else wants to hack on it.
-Adam V.
http://adamv.com
Have you ever wanted to publish your source code with your syntax
highlighting intact? That is, formatted the way that TextMate sees
it? Well, thanks to a recent update to TextMate[1], it's now
possible. I've created two commands that are in the TextMate
subversion repository[2] that are in the Experimental bundle:
Create HTML from Document / Selection:
This command will take your entire document and create a new one
that is an HTML file which recreates the view of your document as
TextMate renders it. It also preserves the colors that you're using
as your current TextMate theme, since it generates the CSS from your
theme file. If you have a selection, this command will only output a
'<pre>' block for that section (instead of generating a full HTML
document plus stylesheet).
Create CSS from Theme:
This command creates a new CSS document that is based on your
current theme.
So, what is this good for? Well, if you want to publish snippets of
code, nicely highlighted, but don't want to create images. Besides,
textual examples are better than images since they're searchable.
So, you could create the CSS rules based on your theme, then add it
to your existing site's stylesheet. Then, you can invoke the "Create
HTML..." command to create the HTML.
Why did I do this? There are many syntax highlighting solutions out
there (indeed, TM itself has a few commands that do this kind of
thing, but they don't reliably reproduce the document the way TM sees
it). But this one leverages the document parsing TM does-- and
therefore, it works with any language definition that is in your
TextMate bundle set. It also doesn't require any additional software
to be installed.
Please report any errors you find to me. And thanks again to Allan
for adding support necessary to do this.
Brad Choate
http://bradchoate.com/
[1] - Release 948's "One can now access the document as parsed by
TextMate." new feature. So these commands require that release or later.
[2] - http://anon:anon@macromates.com/svn/Bundles/trunk/Bundles/
Experimental.tmbundle/Commands/
Eric thanks for the widget. It's great.
I have made a few small changes to the widget.
It perhaps looks slightly better, is resizeable, sorts the projects by name
(ignoring case) and only searches in the users home directory.
It can be found here:
http://email2ants.googlepages.com/TextMateProjects.wdgt.zip
Regards,
Anthony
-----Original Message-----
From: textmate-bounces(a)lists.macromates.com
[mailto:textmate-bounces@lists.macromates.com] On Behalf Of Eric Coleman
Sent: 08 May 2006 15:20
To: TextMate users
Subject: [TxMt] Anyone interested in...
A Dashboard widget that listed your textmate project files? I have a
saved search right now that lists all the textmate project files, and
thought a widget would be nice.
If anyone's interested, I'll toss something together ;)
Regards,
Eric
http://www.theaftermac.com/interview-allan-odgaard/
I still can't your product convinced me to move away from my beloved
Zend Studio. I've used the IDE since they day it came out (until I
discovered TextMate and was blown away)
Eric Coleman
Selecting text from the right to the left, stopping the selection
before the tab trigger does in fact allow for tab triggered snippets
with a selection.
tab_trigger<Selection_end>SELECTED_TEXT<Selection_start>
There are a couple of bad things about this.
There is no way to know how your selection was made, since you can't
see the caret when you have a selection.
That, and the TM_SELECTED_TEXT variable isn't available.
Making the TM_SELECTED_TEXT variable work shouldn't be too difficult
(I would imagine).
But making the caret visible with a selection would really be weird.
I'd still like it, but i may be the only one.
thomas Aylott—subtleGradient—oblivious(a)subtleGradient.com
A Dashboard widget that listed your textmate project files? I have a
saved search right now that lists all the textmate project files, and
thought a widget would be nice.
If anyone's interested, I'll toss something together ;)
Regards,
Eric
Is it possible to have Python fold a complete class
definition, rather than just the "class ..." statement
and the docstring? I looked at the bundle source code,
and I don't know if a regex (or more) can do it. It
seems like a Python parser is needed.
Just curious,
--Dave