I've found myself using TM for almost every single thing that I write, so sometimes I like to be able to create a new TM document in the current Finder window.
Had a look at trying to create a Contextual Menu plug-in, but it looked too complicated, so does anyone have a suggestion for how to do this ??
Kind regards,
Mats
---- "TextMate, coding with an incredible sense of joy and ease" - www.macromates.com -
At 3:13 PM +0000 2/11/05, Mats Persson wrote:
I've found myself using TM for almost every single thing that I write, so sometimes I like to be able to create a new TM document in the current Finder window.
Had a look at trying to create a Contextual Menu plug-in, but it looked too complicated, so does anyone have a suggestion for how to do this ??
OnMyCommandCM (free at http://www.abracode.com/free/cmworkshop/) lets you write your own CMs using shell scripts. I just downloaded it and have quickly hacked out two contextual menu commands:
Edit in TM (pop it up on a file) Edit New File Here in TM (pop it up on a directory; if you pick a file, it puts a new file in the same directory)
To install: 1. Download and install OMC. 2. Make sure you have the 1.1b5 tm CLI command. 3. Download OnMyCommandCMs from http://macromates.com/svn/Bundles/trunk/Tools/CM/ 4. Import the commands using the OMC_Edit tool in the OMC folder. 5. It expects ~/bin/tm to be the binary. If yours is elsewhere, use OMC_Edit to change the paths.
I hope that helps.
best, Eric
On 11 févr. 05, at 20:16, Eric Hsu wrote:
OnMyCommandCM (free at http://www.abracode.com/free/cmworkshop/) lets you write your own CMs using shell scripts. I just downloaded it and have quickly hacked out two contextual menu commands:
Edit in TM (pop it up on a file) Edit New File Here in TM (pop it up on a directory; if you pick a file, it puts a new file in the same directory)
To install:
- Download and install OMC.
- Make sure you have the 1.1b5 tm CLI command.
- Download OnMyCommandCMs from
http://macromates.com/svn/Bundles/trunk/Tools/CM/ 4. Import the commands using the OMC_Edit tool in the OMC folder. 5. It expects ~/bin/tm to be the binary. If yours is elsewhere, use OMC_Edit to change the paths.
I hope that helps.
best, Eric
You beat me to it Eric,
I made the "new file" command a bit differently.
The command opens a dialog asking for a name for the new file and I used "open -a" instead of "tm" CLI command ". IMO, the advantage is that the Syntax highlight is selected according to the extension you gave to the file name. Plus, with the tm CLI, the file doesn't "exists" until you save it and you have to "Saves as" to give it a proper name.
And I made it in Ruby cause I'm lazy. ;) (Maybe Eric could make it in shell?)
So, follow the Eric's recommandations to install and modify.
Change the Ruby and TextMate path in OMCEdit if you have to.
I don't have write access to the repository, so here is the command: http://osxgeek.com/tm/TM-OMC.zip Included is the "Edit in TM" command with "open -a" too.
BTW, I recommend OMC to everyone, you can do a lot of stuff with it. I use it all the time.
Hope this helps.
-- Fred
At 11:41 PM +0100 2/11/05, fatal wrote:
You beat me to it Eric,
Well, heck if I'd known you were working on it, I wouldn't have bothered! :) (I'm not supposed to be working on this non-work kind of stuff...) Maybe next time we should write to the list and reserve a request. I personally would rather other people write these gadgets for me!
(Hey, Chris Thomas, weren't you going to write an Icon Chooser? Don't make me do it...)
There are a few more CMs that I was thinking should be written. Basically all the ones aimed at BBEdit at the OMC site could be altered for TM. Also, a simple 'Edit this Selected Text in TM'. I found myself in Equation Service trying to write some LaTeX and missing a decent editor... but Equation Service doesn't (wait for it) support Services. Oh well. I also had this visionary idea of having a 'Edit Filenames in TM' CM. I often have annoying rename tasks (like chop off a leading word and add an extension) that would take 3 seconds in TM but forever either in the Finder or an annoying amount of time getting a shell script loop right. But if I could just select a bunch of files, send it to TM and edit them there... ahhh. It wasn't obvious to me how to deal with cases where someone deleted a lines, etc. I told you it was visionary.
The command opens a dialog asking for a name for the new file and I used "open -a" instead of "tm" CLI command ". IMO, the advantage is that the Syntax highlight is selected according to the extension you gave to the file name. Plus, with the tm CLI, the file doesn't "exists" until you save it and you have to "Saves as" to give it a proper name.
I thought that was a feature of my version. :) Seriously, I didn't want to deal with name collisions etc etc. But maybe if it turns out people want that feature, I'll put your version in the svn repository...
And I made it in Ruby cause I'm lazy. ;) (Maybe Eric could make it in shell?)
How do you do it in Ruby? Do you have OMC just call the Ruby script, or can it support Ruby inline?
best, Eric
On 12 févr. 05, at 02:46, Eric Hsu wrote:
At 11:41 PM +0100 2/11/05, fatal wrote:
You beat me to it Eric,
Well, heck if I'd known you were working on it, I wouldn't have bothered! :) (I'm not supposed to be working on this non-work kind of stuff...) Maybe next time we should write to the list and reserve a request. I personally would rather other people write these gadgets for me!
Well, in fact, I was not supposed to play with this neither. I'm far from being a shell script guru, but if I can help...
(Hey, Chris Thomas, weren't you going to write an Icon Chooser? Don't make me do it...)
There are a few more CMs that I was thinking should be written. Basically all the ones aimed at BBEdit at the OMC site could be altered for TM. Also, a simple 'Edit this Selected Text in TM'. I found myself in Equation Service trying to write some LaTeX and missing a decent editor... but Equation Service doesn't (wait for it) support Services. Oh well. I also had this visionary idea of having a 'Edit Filenames in TM' CM. I often have annoying rename tasks (like chop off a leading word and add an extension) that would take 3 seconds in TM but forever either in the Finder or an annoying amount of time getting a shell script loop right. But if I could just select a bunch of files, send it to TM and edit them there... ahhh. It wasn't obvious to me how to deal with cases where someone deleted a lines, etc. I told you it was visionary.
I'll take a look at the command aimed at BBEdit. 'Edit Filenames in TM' can be more tricky, I guess.
The command opens a dialog asking for a name for the new file and I used "open -a" instead of "tm" CLI command ". IMO, the advantage is that the Syntax highlight is selected according to the extension you gave to the file name. Plus, with the tm CLI, the file doesn't "exists" until you save it and you have to "Saves as" to give it a proper name.
I thought that was a feature of my version. :) Seriously, I didn't want to deal with name collisions etc etc. But maybe if it turns out people want that feature, I'll put your version in the svn repository...
I didn't mean my version was better or anything, its just the way I wanted it. My script is really basic, but there's no real danger with name collisions, except changing the file's date. It just "touch" then "open" the file. (I'll had a comment about the date change in case of filenames already in use.) Please, tell me if you see other caveats in this approach.
And I made it in Ruby cause I'm lazy. ;) (Maybe Eric could make it in shell?)
How do you do it in Ruby? Do you have OMC just call the Ruby script, or can it support Ruby inline?
As of v. 1.6.1 OnMyCommand has "Full support for shell scripts. Finally you can use perl, python or other scripting language directly in your command."
You just have to write the proper shebang line before the script, then:
"This execution mode creates a temporary script file: /tmp/OMC/OMC_temp_script_XXX and then "exec /tmp/OMC/OMC_temp_script_XXX" is called."
Much easier when you have to share the command with others.
-- Fred
P.S:I realize I didn't use my usual email address in my previous message this thread, sorry.
At 4:53 AM +0100 2/12/05, Fred B. wrote:
I didn't mean my version was better or anything, its just the way I wanted it.
Cool, I didn't take it that way. There Are Many Ways To Do It. :)
My script is really basic, but there's no real danger with name collisions, except changing the file's date. It just "touch" then "open" the file. (I'll had a comment about the date change in case of filenames already in use.) Please, tell me if you see other caveats in this approach.
I wasn't the one who requested the CM, but I was guessing that one always would either want to open an existing file (so you'd click on it) or to open a fresh new one. In this second case, one would not want to see the contents of a file you accidentally named.
best wishes, Eric
On 12 févr. 05, at 19:23, Eric Hsu wrote:
I wasn't the one who requested the CM, but I was guessing that one always would either want to open an existing file (so you'd click on it) or to open a fresh new one. In this second case, one would not want to see the contents of a file you accidentally named.
For my own use, I prefer it the way it is. If I use a name already taken I might as well want to see what's in there. But if someone want it the other way, I can do it, no problem.
Thanks for your time. -- Fred
On 11 Feb 2005, at 15:13, Mats Persson wrote:
Had a look at trying to create a Contextual Menu plug-in, but it looked too complicated, so does anyone have a suggestion for how to do this ??
A big THANK YOU is due to both Eric and Fred for their help with this. Apologies for not responding earlier, been out of it for most of the week with a flu and is only now trying to catch up with things.
Kind regards,
Mats
---- "TextMate, coding with an incredible sense of joy and ease" - www.macromates.com -
At 1:53 PM +0000 2/19/05, Mats Persson wrote:
Had a look at trying to create a Contextual Menu plug-in, but it looked too complicated, so does anyone have a suggestion for how to do this ??
A big THANK YOU is due to both Eric and Fred for their help with this. Apologies for not responding earlier, been out of it for most of the week with a flu and is only now trying to catch up with things.
Also, I have submitted Fred's alternate contextual menu to the svn server at http://macromates.com/svn/Bundles/trunk/Tools/CM/
so people can have their pick! Fred, let me know if you don't want it part of the distribution.
- Eric
On 19 févr. 05, at 18:47, Eric Hsu wrote:
Also, I have submitted Fred's alternate contextual menu to the svn server at http://macromates.com/svn/Bundles/trunk/Tools/CM/
so people can have their pick! Fred, let me know if you don't want it part of the distribution.
No problem, of course. But could you put my last version, please? (included in this mail)
There's no need to edit paths anymore (I use /usr/bin/ruby) and I added a few "Commands for BBEdit and other editors" adaptations for TM.
I won't use most of them, but they might be useful to someone. Plus, I think It's good to have equivalent versions for TM.
Till now, there is:
-New TextMate file here -New TextMate file here with Clipboard text -Edit in TextMate -Open selected text in TextMate -Set type and creator to TextMate -Edit OMC commands in TextMate -List folder content in TextMate -List pkg content in TextMate
Maybe Allan could give me svn access so I could update those and add new commands?
Eric, I could include your commands and mine in the same plist, update the readme, etc. What do you think?
Then I could send them to be included in "officials" OMC commands.
At 11:05 PM +0100 2/20/05, Fred B. wrote:
No problem, of course. But could you put my last version, please? (included in this mail) Maybe Allan could give me svn access so I could update those and add new commands?
Good idea. I will wait for you to get access from Allan. That will give you practice with svn and save me some work!
I won't use most of them, but they might be useful to someone. Plus, I think It's good to have equivalent versions for TM.
Eric, I could include your commands and mine in the same plist, update the readme, etc. What do you think? Then I could send them to be included in "officials" OMC commands.
Great idea! - Eric
On Feb 21, 2005, at 0:04, Eric Hsu wrote:
At 11:05 PM +0100 2/20/05, Fred B. wrote:
Maybe Allan could give me svn access so I could update those and add new commands?
Sure I can add you! Strangely I did not get this letter Eric replied to...
Fred, do you have a last name or do you want your full name to be “Fred B.” in the repository?
On 21 févr. 05, at 08:20, Allan Odgaard wrote:
On Feb 21, 2005, at 0:04, Eric Hsu wrote:
At 11:05 PM +0100 2/20/05, Fred B. wrote:
Maybe Allan could give me svn access so I could update those and add new commands?
Sure I can add you! Strangely I did not get this letter Eric replied to...
Strange! I resent it to you only.
Fred, do you have a last name or do you want your full name to be “Fred B.” in the repository?
Yes, indeed, I have a last name. lol My name is Ballériaux, Frédéric Ballériaux. ;) But you can use FredB. or whatever.
At 8:55 AM +0100 2/21/05, Fred B. wrote:
My name is Ballériaux, Frédéric Ballériaux. ;) But you can use FredB. or whatever.
I discovered something weird with svn. I put your name into the README, and then attempted to put an svn commit message of "Added Frédéric Ballériaux". It rejected the message saying 'Can't recode string'. Weird! The accents aigue freaked svn out. It has something to do with locale confusion as described at http://svn.haxx.se/users/archive-2005-01/1165.shtml. I am too tired to sort it out, and just put you as Fred B in the commit message.
best, Eric
On Feb 21, 2005, at 9:05, Eric Hsu wrote:
I discovered something weird with svn. I put your name into the README, and then attempted to put an svn commit message of "Added Frédéric Ballériaux". It rejected the message saying 'Can't recode string'. Weird! The accents aigue freaked svn out. It has something to do with locale confusion as described at http://svn.haxx.se/users/archive-2005-01/1165.shtml. I am too tired to sort it out, and just put you as Fred B in the commit message.
You need to set LANG to en_US.UTF-8 in TextMate's custom shell variables (or /etc/profile). I have made this default for beta 6.
Btw: the readme you comitted seemed to be in ISO-8859-1 (making stuff like svn blame etc. fail).
On Feb 21, 2005, at 9:23, Allan Odgaard wrote:
You need to set LANG to en_US.UTF-8 in TextMate's custom shell variables (or /etc/profile). I have made this default for beta 6.
Btw: the readme you comitted seemed to be in ISO-8859-1 (making stuff like svn blame etc. fail).
Oh, reading this again makes me think you've set TM to save in Latin 1, and that was the problem (that svn is actually setup correctly to use UTF-8 and thus choked on the latin 1 commit message)...
I can't say it enough: UTF-8 is the king of encodings, and everybody should use it! :)
If you go to TextMate Preferences / Advanced you can disable “Only apply to new files” under File Encoding (which should be in the recommended setting ;) ), then TextMate will also save files which weren't loaded as UTF-8 (or 7 bit ASCII) as UTF-8.
I have this disabled myself.
On 21. feb 2005, at 9:23, Allan Odgaard wrote:
You need to set LANG to en_US.UTF-8 in TextMate's custom shell variables (or /etc/profile). I have made this default for beta 6.
Unless you don't want english. LANG overrides LC_CTYPE which I usually have set to da_DK.ISO_8859-1 (or .UTF-8).
At 9:23 AM +0100 2/21/05, Allan Odgaard wrote:
You need to set LANG to en_US.UTF-8 in TextMate's custom shell variables (or /etc/profile). I have made this default for beta 6.
Btw: the readme you comitted seemed to be in ISO-8859-1 (making stuff like svn blame etc. fail).
Weird. I just did the usual commit writing using TM. However: I did cut and paste FredB's name from Eudora. I wouldn't think that would mess things up, but maybe that bypassed TM's usual reencoding into UTF8? These encodings are definitely not my strong point.
Ah, the answer is...
Oh, reading this again makes me think you've set TM to save in Latin 1, and that was the problem (that svn is actually setup correctly to use UTF-8 and thus choked on the latin 1 commit message)... If you go to TextMate Preferences / Advanced you can disable "Only apply to new files" under File Encoding (which should be in the recommended setting ;) ), then TextMate will also save files which weren't loaded as UTF-8 (or 7 bit ASCII) as UTF-8.
This was the problem. I don't go out of my way to save in Latin 1, but I think either Fred's original email or Eudora's representation is such, and that carried over into TM. I now changed it to your suggested setting.
- Eric
On 21 févr. 05, at 09:05, Eric Hsu wrote:
At 8:55 AM +0100 2/21/05, Fred B. wrote:
My name is Ballériaux, Frédéric Ballériaux. ;) But you can use FredB. or whatever.
I discovered something weird with svn. I put your name into the README, and then attempted to put an svn commit message of "Added Frédéric Ballériaux". It rejected the message saying 'Can't recode string'. Weird! The accents aigue freaked svn out. It has something to do with locale confusion as described at http://svn.haxx.se/users/archive-2005-01/1165.shtml. I am too tired to sort it out, and just put you as Fred B in the commit message.
Guess why I use FredB.? ;) I'm a bit tired of being Fr?d?ric Ball?riaux or Frédéric Ballériaux as in the svn mail I just received. ;D
On Feb 21, 2005, at 9:29, Fred B. wrote:
Guess why I use FredB.? ;) I'm a bit tired of being Fr?d?ric Ball?riaux or Frédéric Ballériaux as in the svn mail I just received. ;D
hehe... the welcome email was another thing I hadn't remembered to fix for utf-8...
But other than that, my infrastructure should be utf-8! ;)
On Feb 21, 2005, at 8:55, Fred B. wrote:
Sure I can add you! Strangely I did not get this letter Eric replied to...
Strange! I resent it to you only.
The mail did show up in the archive, so the problem is on my side.
Fred, do you have a last name or do you want your full name to be “Fred B.” in the repository?
Yes, indeed, I have a last name. lol My name is Ballériaux, Frédéric Ballériaux. ;) But you can use FredB. or whatever.
I used the accented version and forgot that commit messages sent to the ML doesn't get the headers encoded, but everything else should be UTF-8! :)
// Mail is bouncing back from Allan address,
----- The following addresses had permanent fatal errors ----- allan@macromates.com (reason: 550 Error: Your email program uses "=20" instead of spaces. Please correct this (try setting your mail program to use plain text) and resend your message.)
But this was plaintext... Weird. Might be because of the plist included, so I replaced it with a link and resend it to the list (and to you Allan, just to test), sorry if you already had it. //
On 19 févr. 05, at 18:47, Eric Hsu wrote:
Also, I have submitted Fred's alternate contextual menu to the svn server at http://macromates.com/svn/Bundles/trunk/Tools/CM/
so people can have their pick! Fred, let me know if you don't want it part of the distribution.
No problem, of course. But could you put my last version, please?(http://osxgeek.com/tm/TM-OMC.zip)
There's no need to edit paths anymore (I use /usr/bin/ruby) and I added a few "Commands for BBEdit and other editors" adaptations for TM.
I won't use most of them, but they might be useful to someone. Plus, I think It's good to have equivalent versions for TM.
Till now, there is:
-New TextMate file here -New TextMate file here with Clipboard text -Edit in TextMate -Open selected text in TextMate -Set type and creator to TextMate -Edit OMC commands in TextMate -List folder content in TextMate -List pkg content in TextMate
Maybe Allan could give me svn access so I could update those and add new commands?
Eric, I could include your commands and mine in the same plist, update the readme, etc. What do you think?
Then I could send them to be included in "officials" OMC commands.