Skip to content

Instantly share code, notes, and snippets.

@olesku
Last active January 2, 2016 16:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save olesku/8334285 to your computer and use it in GitHub Desktop.
Save olesku/8334285 to your computer and use it in GitHub Desktop.
import sublime, sublime_plugin, os
class ScpOnSave(sublime_plugin.EventListener):
def on_post_save(self, view):
remoteFolders = [
[ "/home/oles/Code/project", "oles@skudsvik.no:~/www/project" ]
]
fileName = view.file_name()
for remoteFolder in remoteFolders:
if fileName.startswith(remoteFolder[0]):
myFile = fileName[len(remoteFolder[0]):]
remoteFile = remoteFolder[1] + myFile
scpCmd = "/usr/bin/scp %s %s" % ( fileName, remoteFile )
os.system(scpCmd)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment