Created
December 20, 2012 14:28
-
-
Save unixmonkey/4345582 to your computer and use it in GitHub Desktop.
A SublimeText 2 Plugin to auto-scp files to an ssh server on save
http://net.tutsplus.com/tutorials/python-tutorials/how-to-create-a-sublime-text-2-plugin/
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import sublime_plugin, os | |
| class RemoteEdit(sublime_plugin.EventListener): | |
| def on_post_save(self, view): | |
| remote = { "/local/path/to/project": "/usr/bin/scp '$1' username@remote_host:'/remote/path/to/project$2'" } | |
| for dirname, target in remote.iteritems(): | |
| if view.file_name().startswith( dirname ): | |
| target = target.replace( "$1", view.file_name() ) | |
| target = target.replace( "$2", view.file_name()[len(dirname):] ) | |
| fname = view.file_name().replace(dirname, '') | |
| os.system( target + " &" ) | |
| os.system( "/usr/local/bin/growlnotify -m 'Copied %s'" % fname ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello! I tried to install this on my MacBook with Mavericks. I followed the tutorial on tutsplus (link in description) and changed the paths and login but after saving the plugin and restarting Sublime Text 2 nothing changed. Every time I hit cmd+s the sublime console does not do anything new. Is there a special trick to load the plugin? Where do I get asked for my ssh password? Thanks!