Skip to content

Instantly share code, notes, and snippets.

@daohodac
Created December 6, 2013 12:50
Show Gist options
  • Save daohodac/7823245 to your computer and use it in GitHub Desktop.
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)
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