Created
December 6, 2013 12:50
-
-
Save daohodac/7823245 to your computer and use it in GitHub Desktop.
plugin sublime text 2 to copy all the files in a directory in to a remote one after each save (hardcoded items)
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 = { "/Users/dao/Documents/work/IT/tests/d3": "/usr/bin/scp '$1' [email protected]:/home/hodac/bin/fleet/d3/" } | |
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