Re: Switching between BBEdit and Textmate

2008-09-30 Thread Lee Hinde
On Mon, Sep 29, 2008 at 8:47 AM, Maarten Sneep [EMAIL PROTECTED]wrote:


 On 25 sep 2008, at 10:36, Nevan King wrote:

  Is there a quick way to quickly switch editing a file between BBEdit
  and Textmate? For example, if I'm editing a file in BBEdit and I want
  to open the same file in Textmate, usually I'll drag the icon from the
  menubar onto the Textmate icon, then save when I finish and go back to
  BBEdit. I'd find this easier if I could set up a shortcut key (even
  better if I could do it in both BBEdit and Textmate). The way you can
  switch editing between Photoshop and Illustrator is a good example.

 This AppleScript will switch from BBEdit to TextMate:

 (* Script to switch a document from BBEdit to TextMate.
 Written by Maarten Sneep, 2008. Enjoy *)

 tell application BBEdit
-- save the active document
if (modified of active document of window 1) then
save active document of window 1
end if
-- get path of active document
set mypath to get file of active document of window 1
-- get line number of insertion point
set theSelection to selection
set theline to (startLine of selection)
-- Hope that 'mate' is installed in a location that is in the
 standard path.
-- if sh complains, use full path here.
-- assumes mate can be called with a +linenumber argument to set the
 active line.
do shell script mate +  (theline as string) quoted form
 of
 (POSIX path of mypath)
 end tell

 -- end script


I changed the last line as follows: do shell script /usr/local/bin/mate  
 quoted form of (POSIX path of mypath)

Sending the line number just confused TextMate.

Thanks for this!




 Maarten




--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups BBEdit Talk group.
To post to this group, send email to bbedit@googlegroups.com
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/bbedit?hl=en
If you have a specific feature request or would like to report a suspected (or 
confirmed) problem with the software, please email to [EMAIL PROTECTED] 
rather than posting to the group.
-~--~~~~--~~--~--~---



Re: Switching between BBEdit and Textmate

2008-09-30 Thread Maarten Sneep

On 30 sep 2008, at 23:09, Lee Hinde wrote:

 I changed the last line as follows:
   do shell script /usr/local/bin/matequoted form of (POSIX  
 path of mypath)

 Sending the line number just confused TextMate.

Ah, mate does not use the syntax pretty much _every_ other editor uses  
(vi, emacs, nedit, bbedit), but wants this in another optional  
argument. This should work:

do shell script /usr/local/bin/mate -l   (theline as string) 
 quoted form of (POSIX path of mypath)

Maarten

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups BBEdit Talk group.
To post to this group, send email to bbedit@googlegroups.com
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/bbedit?hl=en
If you have a specific feature request or would like to report a suspected (or 
confirmed) problem with the software, please email to [EMAIL PROTECTED] 
rather than posting to the group.
-~--~~~~--~~--~--~---



Re: Switching between BBEdit and Textmate

2008-09-29 Thread Maarten Sneep

On 25 sep 2008, at 10:36, Nevan King wrote:

 Is there a quick way to quickly switch editing a file between BBEdit
 and Textmate? For example, if I'm editing a file in BBEdit and I want
 to open the same file in Textmate, usually I'll drag the icon from the
 menubar onto the Textmate icon, then save when I finish and go back to
 BBEdit. I'd find this easier if I could set up a shortcut key (even
 better if I could do it in both BBEdit and Textmate). The way you can
 switch editing between Photoshop and Illustrator is a good example.

This AppleScript will switch from BBEdit to TextMate:

(* Script to switch a document from BBEdit to TextMate.
Written by Maarten Sneep, 2008. Enjoy *)

tell application BBEdit
-- save the active document
if (modified of active document of window 1) then
save active document of window 1
end if
-- get path of active document
set mypath to get file of active document of window 1
-- get line number of insertion point
set theSelection to selection
set theline to (startLine of selection)
-- Hope that 'mate' is installed in a location that is in the  
standard path.
-- if sh complains, use full path here.
-- assumes mate can be called with a +linenumber argument to set the  
active line.
do shell script mate +  (theline as string) quoted form of  
(POSIX path of mypath)
end tell

-- end script

Copy and paste the script text in the Script Editor, and save the  
compiled script in ~/Library/Application Support/BBEdit/Scripts//.  
Keyboard shortcuts can be added from the Scripts Palette in the  
Windows menu.

I don't know anything about scripting TextMate, you'll have to ask  
elsewhere. The shell command bbedit +linenumber file is available.  
Hope this helps.

Maarten

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups BBEdit Talk group.
To post to this group, send email to bbedit@googlegroups.com
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/bbedit?hl=en
If you have a specific feature request or would like to report a suspected (or 
confirmed) problem with the software, please email to [EMAIL PROTECTED] 
rather than posting to the group.
-~--~~~~--~~--~--~---