> Just have a macro that moves you to the beginning of the line and
> then executes the snippet. Wouldn't that do it? We already do this
> trick in the Sweave bundle. Then you can have the macro have
> whatever trigger your snippet was going to have.
Thanks, Charilaos (cool idea). Unfortunately, this won't work well
in my situation because the point of the snippet is to assign some
HTML text to a PHP variable, like this:
$myVar = <<<EOQ
<table cellspacing="0" cellpadding="0" border="0">
<tr align="left" valign="middle">
<td>
Data
</td>
</tr>
</table>
EOQ;
The macro would place the caret to the left of the indented $myVar
string, then run my snippet (which would not work properly).
Allan's solution looks promising, but I cannot figure out where the
place this key in the snippet's plist file:
<key>disableOutputAutoIndent</key>
<true/>
--Cliff
>> Hi. I have the following TM snippet (scope = source.php, tab
>> trigger = eoq):
>>
>> <<<EOQ
>> ${0}
>> EOQ;
>>
>> My snippet works fine, except: the trailing EOQ needs to always be
>> placed at the beginning of a line. Currently, the trailing EOQ
>> winds up at the same indent position as the beginning "<<EOQ".
>>
>> Does someone know of a way to move the caret to the beginning of a
>> line within a snippet? [...]
>>
>
> You can have it inserted without the snippet being indented to the
> current level, the following trick works for tmSnippet files as
> well: http://lists.macromates.com/pipermail/textmate/2007-March/
> 018523.html
Thanks for the quick reply, Allan.
I tried it, but I must not be putting the disableOutputAutoIndent key
in the correct place (I tried several). Below is the contents of my
snippet's plist file. Where would I place the
disableOutputAutoIndent key?
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://
www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>content</key>
<string><<<EOQ
${0}
EOQ;
</string>
<key>name</key>
<string>EOQ (eoq)</string>
<key>scope</key>
<string>source.php</string>
<key>tabTrigger</key>
<string>eoq</string>
<key>uuid</key>
<string>12260674-90D0-426D-84F4-C4F314216C06</string>
</dict>
</plist>
Hi. I have the following TM snippet (scope = source.php, tab trigger
= eoq):
<<<EOQ
${0}
EOQ;
My snippet works fine, except: the trailing EOQ needs to always be
placed at the beginning of a line. Currently, the trailing EOQ winds
up at the same indent position as the beginning "<<EOQ".
Does someone know of a way to move the caret to the beginning of a
line within a snippet? Alternatively, is it possible to call a macro
from a snippet? I know I can build a macro that presses the command
and left arrow keys, which will move the caret to the beginning of
the line.
Thanks in advance. --Cliff
Hi,
is there any difference to insert something as snippet by using a
normal tmSnippet and tmCommand which is set to the output 'Insert as
Snippet' and input 'selected text or line'?
My problem:
I have a document containing the line:
build_cpu=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/
1/'` ;
At the end of that line I'd like to insert a snippet '${1:Hallo}
World'. If I do it via a tmSnippet it works perfectly. But if I write
a tmCommand à la:
Command:
in=$(cat)
caret=$TM_COLUMN_NUMBER-1
lnhead=${in:0:$caret}
lnend=${in:$caret}
echo -en "$lnhead\${1:Hallo}World$lnend"
Output: Insert as Snippet
Input: sel. text or line
it crashes, meaning TM inserts: 'build_cpu= ; HalloWorld'.
Maybe TM has some problems while parsing the line? But as tmSnippet
it works?
If you change the output to 'Show as Tooltip' the command did the job
correctly. I only can guess that if in the line occurs a '$' TM will
have problems. And if this is true, what can I do? I already tried to
escape all '$' in the variable 'in' but no success.
Any hint would be very helpful. The example as tmCommand I attached
to this mail.
Thanks,
Hans
Hi.
I'm having some problems with textmate jumping in the encoding. I
have e.g. a website which is saved in iso-8859-1 and correctly opened
in the same format.
I then have some text from a word file that i copy. This text is in
danish, so it have some of the danish letters (æøå).
When I paste this into the before mentioned document in Textmate, the
whole document changes to UTF-8. Because of this when I save it and
upload it, all the dansih letters becomes garbage text (because it
tries to open it as a iso-8859-1 as I have specified).
The same thing happens in Textmate if i try reopen it as iso-8859-1
But is there any reason for Textmate to change the encoding of the
document just because I paste some text, and can I avoid it ?
Regards
Danny Krøger
Hi,
I have a tiny suggestion.
For me it is often the case that I have to replace, let's say hex
\x0B (TAB INDENTION), with '\n'. If I do it using TM's Find/Replace
dialog it takes several minutes for a file with 400 lines and, let's
say 4000 occurrences of '\x0B'. Furthermore TM occupies a lot of my
CPUs.
If I do the same by using the 'Filter-Command' with e.g. 'perl -npe s/
\x0B/\n/g' it only takes a few seconds.
I could image that the speed problem arises if the Find/Replace
routine has to insert '\n'.
Would it make sense to include an option or button within the Find/
Replace dialog, like 'External Replace All' or whatever, to call an
external maybe perl/sed/ruby routine to do the job, esp. if I want to
insert many NEW LINES?
I don't know what kind of disadvantages it would have.
Of course, one could write a tmCommand with a dialog to do it (or
using the Filter command), but in order to avoid additional typing I
would suggest to include such a functionality within TM's Find/
Replace dialog. Esp. for users who don't know the syntax to write
such a regular expression would it be helpful, I think.
Cheers,
Hans
Howdy.
I know this has been covered before.
But…
Has anyone figured out a way to make the gear menu work and have
Apple Remote Desktop installed at the same time?
I'm SO sick of the gear menu shortcut being useless on all of my
machines.
⌘⌃t is lovely, but doesn't replace the wonderful gear menu.
thomas Aylott — subtleGradient — CrazyEgg — sixteenColors
I want to contribute some patches to the Perforce bundle, but I need
to clear up some confusion first...
http://macromates.com/wiki/Bundles/HowToContribute tells me to start
by checking out the latest version into ~/Library/Application
Support/TextMate/Bundles. (That's where the Perforce bundle is now,
which I downloaded using the GetBundle bundle.)
But http://macromates.com/textmate/manual/bundles#installing_a_bundle
tells me to create /Library/Application\ Support/TextMate/Bundles/ and
install them there.
Then I'm further confused by the following in
http://macromates.com/wiki/Bundles/HowToContribute:
> Normally it is not recommended that you checkout bundles to the above
> location [~/Library/..., I guess], because when you change the bundle
> items from inside TextMate, it saves changes to ~/Library/…,
> potentially leading to merge conflicts if the files are updated in an
> incompatible way on the server.
>
> If you already have done a full checkout of the repository to /Library
> then you can instead do a symbolic link...
So what should I do? Should I check out the Perforce bundle to
/Library/... or ~/Library/...? Should I ignore the instructions to
create a symbolic link, since I haven't done a full checkout to
/Library/...?
--
Daryl Spitzer
Hi,
in my bundle, there are several hundred snippets. Is there any secret
how I can make these dissapear from the menu at the bottom line of the
window, left to the one with 'tab size: '? I'd like to list the
interesting ones only.
Patrick