Here are 3 macros, 3 commands, and a small Ruby program that take the
DRY principle to another level while writing Rails migrations.
These snippets for creating a table, adding a column, and renaming a
column will add the opposite actions into self.down for you. I made a
30 second demo video so you can see them in action. You'll find all
this on my blog. The address is in my signature.
Hope some of you find this useful.
--
Sami Samhuri
http://sami.samhuri.net
I really like the project drawer and I always keep it on the left-hand
side. This is not a problem as long as I use a single window: textmate
opens it up in the same location as when I last closed it.
But if I open up another window (with a drawer), it is always opened
with the drawer on the right hand side. It's really annoying, because
(as far as I can tell) the only way to switch drawer sides is to move
the window to the right screen edge and then toggle it off and back on
again. This wastes quite a lot of time.
Is there a way to force left side drawers?
Steven Wittens
> #!/usr/bin/perl
> local $/; # put Perl in "slurp" mode
> $text = <>; # read in the whole file
> $text =~ s/^([A-Z ]+)\n(\(.+\))\n(.+)$/\n\n\t\t\t\t$1\n\t\t\t$2
> \n\n$3/mg;
> print $text;
Of all the solutions proposed here, this once seemed to work the
best. Thanks for the tip about processing the entire document in one go.
I ended up with the following:
#!/usr/bin/perl
local $/; # put Perl in "slurp" mode
$text = <>; # read in the whole file
$text =~ s/(\s+)$//mg;
$text =~ s/((INT.|EXT.|I\/E.|int.|ext.|i\/e.)\s.*)$/\*\*\*$1/mg;
$text =~ s/^([A-Z].*[A-Z \)])\n^(\(.*\))$\n(.+)$/\n\t\t\t\t$1\n\t\t\t
$2\n\t\t$3\n/mg;
$text =~ s/^[A-Z]{2,}.*[A-Z\)\d]$\n^(.*)$/\n\t\t\t\t$1\n\t\t$2\n/;
$text =~ s/^\*\*\*//mg;
$text =~ s/^(.*(IN:|UP:|TO:))$/\n\t\t\t\t\t\t\t\t\t\t$1\n/;
$text =~ s/^(\w+.*(\.|\?|\!|\"|\-))$\n^\w+.*(\.|\?|\!|\"|\-)$/\n$1/mg;
print $text;
...but it doesn't work at all. I'm guessing that it's something
obvious that I can't see, but in case it's not an explanation of what
I'm trying to do follows.
1. removes trailing whitespace at the end of a string (which is
common in the format I'm importing from.
2. appends three *'s to the beginning of what I'll call well-formed
sluglines so that step 4 doesn't apply to these are well.
3. finds a specific set of lines, a Character followed by
Parenthetical, followed by Dialoge. And formats it.
4. finds Character followed by Dialogue when there is no
Parenthetical, and formats it.
5. repairs the sluglines that were changed in step 2.
6. formats transitions.
7. formats regular paragraphs (this is a little funky, but it's my
fault).
I can do all these in the Find&Replace window, but I get nothing when
running this bundle command.
You can find a sample document to test the script on here: http://
ollieman.net/files/bundles/braveheart-sample-unformatted.txt
And you can find what the result should look like here: http://
ollieman.net/files/bundles/braveheart-sample-formatted.txt
Thanks again for all the help. This will allow we to switch full-time
from Final Draft to TextMate. Something I'm really looking forward to.
> this would not allow for commands that take the whole document as
> input and the current selection as output, and autocompletion
> thingies wouldn't work _that_ good, so considering this I'm on +1 for
> allan's proposal.
I think some minor changes to the wording of Allan's solution might
make it more readable. What about:
Output: [ Discard ]
[ Text ] and [ pop-up ]
[ Snippet ] and [ pop-up ]
[ HTML ]
[ Tool Tip ]
[ New Document ]
And then the pop-up showing for the Text and Snippet output options
have the folowing options:
and [ Replace Input ]
[ Replace Selection ]
[ Replace Document ]
[ Insert After Caret ]
This version uses more [action verbs][1], which makes it read more
logically.
> by the way, I'd like an option to show the output as a popup menu (or
> something like that): this would perfectly suit autocompletion. think
> about it, al.
I'll second that.
Nice ideas, Allan! Cheers,
Ben
[1]:
http://developer.apple.com/documentation/UserExperience/Conceptual/
OSXHIGuidelines/XHIGMenus/chapter_16_section_3.html#//apple_ref/doc/
uid/TP30000356-TPXREF117
___________________
Ben Jackson
Diretor de Desenvolvimento
ben(a)incomumdesign.com
http://www.incomumdesign.com
hello:)
TeXShop can provide synchronization in two ways.
"pdfsearch" : The default method uses a new ability in Mac OSX 10.4
to search for strings in pdf files.
No special style files need be included to use this method.
"pdfsync" is the original method but needs to add the following line
to the preamble of your tex source code before the \begin{document}
line:
\usepackage{pdfsync}.
Is it to possible to use in the future, the first method "pdfsearch"
with Textmate
Thanks
Alain
hello:)
I've some difficulties with the macro "Convert ASCII Symbol to LaTeX",.
arrowShortcuts.rb is there :
/Library/Application Support/TextMate/Bundles/Latex.tmbundle/Support/
bin/arrowShortcuts.rb
and in the macro we have : command = "\"$TM_BUNDLE_SUPPORT/bin/
arrowShortcuts.rb\"";
or Show TM_* Variables give :
TM_BUNDLE_PATH=/Library/Application Support/TextMate/Bundles/
TextMate.tmbundle
TM_BUNDLE_SUPPORT=/Library/Application Support/TextMate/Bundles/
TextMate.tmbundle/Support
so i think that the script is not found !
the script is fine because i put the code in a command and the
command works very well
But i've a question
TM_BUNDLE_SUPPORT is unique or this variable depends on Bundle ?
how do I have to make so that works?
Thanks
Alain
Hi guys,
The sexy and helpful textmate manual says I can fold/unfold code
blocks using my F1 key. But I can't get it to work. What needs to
be selected? Where should my caret be placed? Do I have to utter
some secret magical phrase while clicking F1?
Thanks,
Sean
:::: DataFly.Net ::::
Complete Web Services
http://www.datafly.net
On Feb 21, 2006, at 10:50 AM, Oliver Taylor wrote:
>> ------------------------
>> ONCE
>> (twice)
>> Three times a lady.
>> Not as much as the Gambler.
>> (This sucks)
>> How would you know?
>> ------------------------
>>
>> How do I match the 2nd line but not the 5th?
>> How do I match the 6th, but not he 3rd?
So I just read in the documentation:
> [...] it is not possible to use a pattern that matches multiple
> lines. [...]
Total bummer, although this still may be possible using "begin" and
"end"
So, to restate my question in a more clear way... (thanks for your
patience Haris) I know nothing about programming...
I'm trying to run a perl search/replace command via a 'bundle
command'. I've entered the following into the 'Edit Command' box:
perl -pe '
s/^([A-Z]+.*[A-Z]*\s*)\n(\(.+\))\n(.+)$/\n\n\t\t\t\t$1\n\t\t\t$2\n\n
$3/g;
'
I've set the input to 'Entire Document' and the output to 'Create New
Document'.
But when I run the command none of the tabs or newlines I've
specified in the replace section of the command are applied to the
text in question. I've also tried the command with the 'e' option at
the end which, as far as I can tell, is supposed to evaluate the
right side of the search/replace command as regex... but it's not
working.
Any help is appreciated.
Just so you know, I'm trying to write a set of commands that will
transform the plai-text output from Final Draft when exporting a
screenplay. If I can get this working then I can bring all my scripts
over to TextMate.
As an example, this:
-----------------
OLIVER
(I want to tell you)
I've got things to say.
Dr. Robert
-----------------
should look like this:
---------------------------
OLIVER
(I want to tell you)
I've got things to say.
Dr. Robert
---------------------------
The Go To File command doesn't show files in the same easy-to-read
hierarchy as the project drawer. This is especially evident when a
project contains many files that have been carefully arranged into
custom groups. In this situation, the flat list of the Go To File
dialog isn't as easy to navigate as the project drawer.
This is why I like to select files directly from the drawer instead
of with Go To File. With mouse navigation, this works fine; I can
simply point and click. But I prefer to use the keyboard as much as
possible, and there doesn't seem to be any way to move the keyboard
focus to the project drawer (unless of course I use the mouse, but
that defeats the whole point of keyboard navigation). Is there some
hidden key combo not mentioned in the manual that will do this? Thanks,
Trevor