Allan, Ciarán, all,
I used the phpdoc snippets a lot in TextMate. I also go back and add
to those phpdoc blocks. When I go back and edit those blocks TextMate
doesn't provide any help.
I created a command and snippet to help:
The Command provides Auto complete when you use a @ in a phpdoc comment.
The second file is a snippet for when you hit enter it puts an
asterisk at the start of the next line.
Timothy
I'm making some custom templates (among other things) for my favorite
languages, and I need some advice/best practices about them.
1. I heard that people are moving away from normal Templates and towards
Snippets for this purpose; is this correct?
2. One advantage I see with Snippets is that it lets me set the filename
(which I can then use) before calling the Snippet, which is not possible
with a Template unless I'm in a project. Is there some way around that with
Templates?
3. As I make these Templates, I'm finding a lot of common text between them,
and when I want to tweak it across the board...well, it's like programming
without functions. What, if anything, can I do to reduce redundancy in my
templates?
Thanks,
Neil.
In developing my bundle, I've been issuing feedback to the user with Create
New Document. Now that things are working decently, I want to switch to Show
As HTML. Here's the problem. Throughout my routines, when I want to issue
some feedback, I just say "puts". Now, however, using Show As HTML, I want
to wrap this in some way such that every time there is a "puts" I grab it,
shove a <br> on the end, and pass it along, so that my output appears
streaming into the HTML window as the script runs.
So, yeah, I could look thru all my code, find every "puts", and append the
<br> myself. But I don't want to. I want to just wrap up what I'm already
doing and perform the transformation as the input appears. There must be
some simple way to do this.
Here's what I have so far:
def self.perform(command_name, *args)
require "#{ENV["TM_SUPPORT_PATH"]}/lib/web_preview.rb"
STDOUT.sync = true
html_header(command_name.to_s)
puts "<pre>"
self.send(command_name, *args) # FIX ME
puts "</pre>"
html_footer()
end
It's that "self.send" line that I want to wrap up in some way so that I can
intercept the output from each "puts" within my routines and modify it.
Oh, and while we're up: is there a way I can detect whether we are currently
set to Create New Document or Show As HTML? I'd like to funnel all my
commands thru this one bottleneck but NOT do all that stuff if we are set to
Create New Document (in that case I just want to pass the output thru
untouched).
Thx! m.
--
matt neuburg, phd = matt(a)tidbits.com, <http://www.tidbits.com/matt/>
A fool + a tool + an autorelease pool = cool!
AppleScript: the Definitive Guide - Second Edition!
http://www.tidbits.com/matt/default.html#applescriptthings
Hi guys,
I just started using Textmate recently and at the moment I am trying to get
some Python scripts working with it. Everything works great but I was
wondering how to you pass command line arguments to a python script when you
run it?
Thanks
Regards
David
Ah ok thanks,
Although it might not be a bad idea to have a different meant to run
it by expanding the python bundle to "Run scripts with Arguments"
Thanks again for a possible solution.
Regards
Dave
On 9 Jul 2009, at 19:53, textmate-request(a)lists.macromates.com wrote:
> There is no support for this, it?s not that we don?t want to provide
> it, just that it?s not really feasible to do without bringing up a
> dialog and that would be a pain for the 99% where you don?t want to
> provide arguments.
>
> What you can do is simply read from stdin then TextMate will show a
> dialog, this is how I handle it in most of my scripts, i.e. read the
> arguments from stdin instead of command line options (when I know I
> mostly run the script in TM).
Hi,
Many of my Textmate commands are slow and take up to 15 seconds. My
problem seems to be the same than the one described in this thread:
http://lists.macromates.com/textmate/2006-January/007647.html. The top
command shows that the bash seems to be taking up all available CPU
cycles while TextMate is loading. This is really annoying, since this
happens with even very basic bundle commands like bolding in LaTeX,
which renders the commands in LaTeX bundle virtually unusable.
I tried the solution provided in this post:
http://lists.macromates.com/textmate/2006-January/007705.html. However,
I don't have fink or any other suspicious lines in my .bash_profile,
.bash_login or .profile files. Does anyone have any idea on what might
possibly cause the problem?
Regards,
Juho
--
Juho Makkonen
+358 41 5022 683
>> This is probably old news to everyone, but the scope of the quote
>> toggle did not include source. [...] I added 'source' to the scope
>> list and this fixed the "problem". I figure toggling quotes is
>> useful in any source location.
>The command is intended to be used without a selection, as it will
>work on the current scope, which is string.quoted.*.
>By adding ?source? to the scope selector you break it for when there
>is no selection (as it will then receive the entire source as stdin).
That will make my life loads easier. Now it works. I swear I tried that
before. Now that I see SOURCE in the source area of the bundle item.
Everything is clear. The Key
Equivalent won't work if you have the quotes selected though, or
anything selected. It
will work if you have the quote selected and you select the bundle item from
the menu. This is what sent me down the wrong path.
Thank you.
--
Brad Tittle
Tech Support
I am working in a project that has many folders corresponding to real
directories. After working for a while, there may be some folders
that are expanded and others that are collapsed. The thing is that if
I close the project and open it again later, then all of the folders
will be collapsed. This is very annoying because I must expand all
the folders I want access to every time I work on the project. Is
there a way for TextMate to maintain the state of which folders are
expanded and which are not the next time I open the project?
Hi Allan, Ciarán, all,
My projects frequently have a git root that is outside the project
directory, sometimes I even use source files from multiple projects/
repositories at the same time.
The appended patch to ProjectPlus allows the git module to handle that
correctly.
Seems the release notes and maybe version are updated by some utility,
so I did not touch them.
Gerd
When I attempt to create a new project called "Foo", I get the following
error:
/tmp/temp_textmate.VmGETS:30:in 'read': No such file or directory -
/Users/jjones/Documents/Code/Foo/___PROJECTNAMEASIDENTIFIER____Prefix.pch
(Errno::ENOENT) /tmp/temp_textmate.VmGETS:30:in 'expand_file'
/tmp/temp_textmate.VmGETS:94:in 'process'
/tmp/temp_textmate.VmGETS:92:in 'each'
/tmp/temp_textmate.VmGETS:92:in 'process'
/tmp/temp_textmate.VmGETS:138
I see that the folder /Users/jjones/Documents/Code/Foo has been created and
a bunch of projects are in there. Not sure what the issue is here and I was
wondering if anyone here knows what to do to get around this?
Thanx,
Joe
For when a single regular expression is not sufficient for a mirror
transformation, is there any way to access current mirror values from
within interpolated shell code in snippets?
(I'm trying to write a transformation that will first convert a human
phrase to CamelCase /then/ lowercase the first character to generate a
StudlyCaps version of the phrase.)
--
Benjamin Hawkes-Lewis
This is probably old
news to everyone, but the scope of the quote toggle did not include
source. At least in my version of the bundle, it just had
string.quoted.double, string.quoted.single. If the quotes were
included in the selection, then the scope devolved to text.html.basic,
source.php.embedded.block.html (my file type
is set to html).
I added 'source' to the scope list and this fixed the "problem". I figure
toggling quotes is useful in any source location.
--
Brad Tittle
Tech Support
Hello,
I needed to write perl code with some arabic letters recently. While
right-to-left languages are (excuse me) pain in the *** on more than
one level, textmate is not really helping me.
if I edit RTL language in TextMate, cursor moves "as expected" (=
right key moves right, lef key moves left), which is not standard
behaviour with RTL languages (in other editors, when you press right
in RTL language, you move left, and left moves right). But that would
be OK.
But it doesn't end there - if you, in TM, edit something on one end of
RTL text, it appears on the OTHER end. So, you are writing something
at the other end of the line, where the cursor is, so you don't know
where you will be writing until you write.
If RTL is mixed with LTR, the letters appear/dissapear randomly, but
never where the cursor is.
Another thing, maybe more important? - the file is actually saved
differently from how it looks in textmate. Example: in textmate, it
looks like this:
http://i41.tinypic.com/b8n636.png
but in textedit (and how perl sees it) it looks like this:
http://i40.tinypic.com/2i2bke8.png
(notice the misplaced parenthesis and semicolon)
I don't really use Arabic much, but I think it is a bug worth fixing.
Karel Bilek
I have a fork of the Perforce bundle, except that I forked it from a
previous GitHub fork that did a SVN import.
When I try to follow the recent instructions for rebasing, I end up
with "no common commits" and no real idea of how to resolve that
situation.
Is there something I can try to get my fork rebased to the official
bundle (and get GitHub to note that), or am I better off just newly
forking the official mirror and replaying the changes?
-Adam Vandenberg
http://adamv.com/
Allan,
First, thank you for creating such a wonderful editor. I've been using
it full time for almost a year now and love it very much.
I've been trying to be mouse less when doing development with TextMate
and iTerms. One thing I feel a little inconvenient is when I have
opened too many tabs, I can not drag files from vertical list to tabs.
Also, there is no keyboard shortcuts to move current tab to re-order
tabs. Please add them to your feature requests if you feel they are
interesting.
Regards,
Cao
I keep seeing this message pop up from time to time, looks to be a
growl notification. Usually at boot, but I've seen it at other random
times.
Anyone have any insight as to what this is? I suppose it's nice that
my bundles are up to date, but I'd rather not have something updating
my bundles without my OK. Looking around in the standard places for
launch at boot items, crontabs, etc. I don't see anything that would
do this.
-Dave
I've asked this before and didn't get an answer that I understood, so I'm
trying again.
My bundle consists of a bunch of ruby scripts, and the output is shown as
HTML. Thus, when a command is given, I am running a ruby script and then
scrambling to transform any output for display as HTML, deal with
exceptions, etc. In other words, I am doing simply and crudely what RubyMate
already does perfectly.
So the question is, isn't there some way I can just *use* RubyMate to run my
scripts and display output and exceptions for me?
m.
--
matt neuburg, phd = matt(a)tidbits.com, <http://www.tidbits.com/matt/>
A fool + a tool + an autorelease pool = cool!
AppleScript: the Definitive Guide - Second Edition!
http://www.tidbits.com/matt/default.html#applescriptthings
On Sat, Jul 4, 2009 at 6:00 AM, <textmate-request(a)lists.macromates.com> wrote:
> ---------- Forwarded message ----------
> From: Scott Haneda <talklists(a)newgeo.com>
> To: TextMate users <textmate(a)lists.macromates.com>
> Date: Fri, 3 Jul 2009 12:40:55 -0700
> Subject: [TxMt] Re: The dreaded Regexp question
> On Jul 3, 2009, at 10:00 AM, Michael Newton wrote:
>
>> Sorry, I know this isn't particularly on-topic (aside from the fact
>> that I'm using Textmate!) but I'm not having luck with the search
>> engines.
>>
>> I have a bunch of HTML that needs to be converted to XHTML, notably
>> <input type="text"> needs to be <input type="text"/> which is easy
>> enough. Problem is, it's PHP so there are things like <input
>> type="<?php echo $type?>"> which I'm having troubles with. So how can
>> I create a regular expression that captures the guts of the HTML
>> brackets, while ignoring any PHP brackets it might come across inside
>> the HTML?
>
>
> I used this web tool to help me:
> http://www.gskinner.com/RegExr/
>
> I did my best to put in single tics, quote marks etc:
> <input type="<?php echo $type?>"> some type and then another input <input type="<?php echo $type?>" name='value' class="foo">
> <input type="some_value">
> <input type="$some_$value">
> <hr>
> <br>
>
> My regex pattern was:
> (</?\w+)((\s+\w+(\s*=\s*(?:".*?"|'.*?'|[^'">\s]+))?)+\s*|\s*)/?(>)
>
> My replace pattern was:
> $1$2$3/>
> * You could do less pattern grouping, I did so as I was working through it.
>
> Result was:
> <input type="<?php echo $type?>" type="<?php echo $type?>"/> some type and then another input <input type="<?php echo $type?>" name='value' class="foo" class="foo"/>
> <input type="some_value" type="some_value"/>
> <input type="$some_$value" type="$some_$value"/>
> <hr/>
> <br/>
>
> The one issue is it will alter plain closing tags, like </a> will become </a/> and I could not wokr that out. Either you can solve that in the regex by ignoring anything with a "/" in it already, or, I may be inclined to cheat. With the recording ability of textmate, I would try something like:
> find "/>"
> replace "#tmp#
> find (</?\w+)((\s+\w+(\s*=\s*(?:".*?"|'.*?'|[^'">\s]+))?)+\s*|\s*)/?(>)
> replace $1$2$3/>
> find "#tmp#
> replace "/>"
>
> It should happen pretty quick.
> --
> Scott * If you contact me off list replace talklists@ with scott@ *
>
Thanks, I actually figured it out just now as I was composing a reply.
Negative lookbehind assertion only matches ">" if it's not preceded by
"?" or "/":
find: <((?:input|img|link|meta|hr|br|area).*?)(?<![?/])>
replace: <$1/>
turns this:
<input name="foo"<?php echo $bar?>>
<input name="foo" value="<?php echo $foo?>">
<input name="foo" <?php echo $bar?>/>
<input name="foo" value="<?php echo $foo?>"/>
<a href="bar">baz</a>
into this:
<input name="foo"<?php echo $bar?>/>
<input name="foo" value="<?php echo $foo?>"/>
<input name="foo" <?php echo $bar?>/>
<input name="foo" value="<?php echo $foo?>"/>
<a href="bar">baz</a>
Just need to see if it works in TM when I get back to my office (and
my Mac!) Definitely bookmarking that site though, and will look more
into this "recording ability."
--
Michael Newton
http://mike.eire.ca/
Although only a TextMate newbie, I would be happy to pay for an
upgrade to version 2.
That said, I can imagine a purchase page that allowed upgraders to
choose from a number of possible "donation" amounts--say, via the sort
of pull-down menu you get when paying for music at http://
Magnatune.com. You could then bury the option to Upgrade for Free
somewhere deep on the page or on another page, so that it's an option
for the needy.
I would also love to contribute a few beers to bundle developers--
perhaps via a similar system or a "checkbox" list.
Thanks to everyone who's contributed to this vibrant community!
jon
/RNN (http://responsenotnecessary.com)
______________________________
Still Water--what networks need to thrive.
http://newmedia.umaine.edu/stillwater/
Sorry, I know this isn't particularly on-topic (aside from the fact
that I'm using Textmate!) but I'm not having luck with the search
engines.
I have a bunch of HTML that needs to be converted to XHTML, notably
<input type="text"> needs to be <input type="text"/> which is easy
enough. Problem is, it's PHP so there are things like <input
type="<?php echo $type?>"> which I'm having troubles with. So how can
I create a regular expression that captures the guts of the HTML
brackets, while ignoring any PHP brackets it might come across inside
the HTML?
Thanks in advance.
Hello,
I had an issue with the Show Outline command from the LaTeX bundle
when using multiple source files spread accross different (relative)
directories.
I took a look at the code and was able to fix it for me by modifying
the line
points += outline_points(filename.adjust_end($1)) if
line.match(INCLUDE_REGEX)
to
points += outline_points(LaTeX.master(filename).adjust_end($1))
if line.match(INCLUDE_REGEX)
Someone with a little more insight might want to check if that is a
good idea and possibly apply it for future versions. :)
Cheers,
Guido
I'm working on adding auto complete to my bundle. I can get the
suggestions to display, but not the tool tip.
The current code section is as follows
completion = {"display" => removed_block,"tool_tip" => "testing this"}
choices.push(completion)
options = {
:extra_chars => '_/' ,
:case_insensitive => false,
:initial_filter => "",
:tool_tip_prefix => 'prefix'
}
TextMate::UI.complete(choices, options)
The choices will display but the tool tip won't.
Timothy
After reading through the comments here:
http://blog.simongregory.com/09/as3-autocompletion-in-textmate/
I have so far failed to get any good looking AS3 autocomplete. What
do I need to do to work out what's going wrong? I am getting this
when I press Alt-Esc:
please select a class to locate the package for
Here's my sample code:
var s:Sprite = new Sprite();
s.(here I press Alt-Esc and get the tooltip)
I can't find the TM log file to look for errors. I have soft linked
my Flex SDK into /Developer/SDKs/flex_sdk_3 as suggested in the
comments on the original thread but I cant make it go. Any suggestions?
Thanks,
Gaby.
--
Sent from my email program on my computer sitting on my desk in my
house.
http://playr.co.uk/
Hey guys,
I wrote a couple snippets for event-based programming in AS3:
-- addEventListener
addEventListener(${1:MouseEvent}.${2:CLICK}, ${3:on${2/(_)?([A-Z])([A-
Z]+)/\u$2\L$3/g}}, ${4:false}, ${5:0}, ${6:true});
-- onEventType
${1:private} function on${2:Click}(event:${3:Event}${4: = null}):
${5:void} {
$0
}
--
I realize that addEventListener is also available in autocomplete.
Here's why you might use it anyway:
- Chording two keys (opt-esc) for a function that is supposed to save
you time (autocomplete) can feel clumsy.
- The tab trigger will autofill a onEventType as a callback for
EVENT_TYPE.
- The above feature works well if you use escape to trigger naive
autocompletion.
Thanks Simon for all your work on the AS3 bundle. Feel free to
include these if you find them worthy. =)
Brenton