I would think it would be pretty trivial to write an applescript and
bind it to a key combo.
--
"Katrina, $4 gas, a trillion dollar war, rising unemployment,
deregulated housing market, global warming...NO MORE!"
http://is.gd/2mxY
> 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
Maarten
> 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.
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
Odd that mate uses a different syntax from bbedit.