Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Using Coda, the all-in-one web editor developed by Panic for OSX, I find myself utilizing a lot of keyboard shortcuts. Particularly the Publish shortcut (command + option + P). The only problem with this shortcut is that it publishes the highlighted file in the file browser, NOT my file currently open in the editor. This brings me to two questions that could potentially circumvent this - please feel free to post any other solutions though.

Possible choice 1: Is it possible to modify the preferences to make the publish shortcut publish the active file in the editor?

Possible choice 2: Is there a keyboard shortcut for the Show in File Browser command? I don't see it listed in the keyboard shortcuts in the help menu.

share|improve this question
add comment

1 Answer

Coda doesn't seem to offer either of your suggestions. So let's just create our own command and add it to Coda.


In Coda, Show Scripts menu in General preferences.

enter image description here

Open /Applications/Utilities/AppleScript Editor.app, create a new document, and paste the following:

tell application "Coda"
    tell document 1
        upload item full name of current editor
    end tell
end tell

This script will upload the file currently being edited and clear its locally modified state. document 1 seems to always be the frontmost Coda window in my limited testing.

Save as ~/Library/Scripts/Applications/Coda/Upload Tab.scpt (if you don't find Library, press Cmd-Shift-. in the file browser or just Open Enclosing Folder in Coda's scripts menu). Select Reload Scripts in Coda's scripts menu and make sure the new command is in there.


Assign a keyboard shortcut in System Preferences.

enter image description here


Here's the new command in Coda:

enter image description here


Coda will ask you what to do if the file already exists on the remote site. Just append with resume mode overwrite (labeled Replace in the GUI; the other options being skip and resume) to the upload command in AppleScript.

share|improve this answer
    
What I didn't do here is fancy error handling and such. Coda shows useful error message itself (File does not exist) for unsaved documents (Untitled.html), and useless error messages if you don't have an active editor, open window, or no remote connection. Just limit your use of the command to when it actually makes sense. –  Daniel Beck Dec 29 '11 at 9:25
    
Awesome. And the message asking whether coda should overwrite the file only appears if we use the upload command, I haven't had a chance to try this yet, but my hope is that if I change upload item full name of current editor to publish item full name of current editor it may fix our issue. –  anwyatt Dec 29 '11 at 21:20
    
@anwyatt I really didn't see the publish command. You're right, of course. –  Daniel Beck Dec 29 '11 at 23:35
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.