bgreenlee / sublime-github

Sublime Text 2/3 plugin that provides a number of useful commands for GitHub.
MIT License
455 stars 92 forks source link

ctrl-s to call update instead of save #18

Closed sheldond closed 1 month ago

sheldond commented 12 years ago

It would be very handy to have the option of specifying in my user key config that when editing a gist and ctrl-s is pressed the update command is called instead of normal save. At this point the file should be marked in ST2 as saved so that upon closing the user isn't prompted to save the gist as a file.

Or more simply: make updating and closing a gist faster :)

Thanks for the plugin!

bgreenlee commented 12 years ago

I looked into this and it doesn't look like it is possible to override save. I can hook into a pre-save or post-save event and update the gist, but you'd still have to save it locally, which is not what you want.

What about just setting a custom key binding for updating the gist? For example, to map shift-alt-U (or shift-cmd-U) to update, just stick this in your Key Bindings - User:

 { "keys": ["super+shift+u"], "command": "update_gist"}
sheldond commented 12 years ago

Thanks for the reply! I've noticed some key bindings have a "context", could it be possible to re-bind ctrl-s to the update_gist when the current file context is a gist? Regardless, setting a hotkey is definitely helpful and speeds things up.

bgreenlee commented 12 years ago

No, I don't think there's a way to do a custom context.

sheldond commented 12 years ago

Okay thanks anyways!

OpaOnWindowsNow commented 12 years ago

We can have a context on a particular kind of file, for instance for Opa language, the following is working : { "keys": ["ctrl+s"], "command": "run_opa_build", "context": [{ "key": "selector", "operator": "equal", "operand": source.opa" } ] }

bgreenlee commented 12 years ago

@OpaOnWindowsNow That's good to know, thanks. That won't help with this issue, though, as gists can be any file type. But I'll reopen the issue anyway so I remember to take a look at it again sometime.