Skip to content

Instantly share code, notes, and snippets.

@MhdSyrwan
Created May 25, 2012 12:16
Show Gist options
  • Save MhdSyrwan/2787693 to your computer and use it in GitHub Desktop.
Save MhdSyrwan/2787693 to your computer and use it in GitHub Desktop.
Sublime Process Launcher
#!/usr/bin/env python
# The following code is taken from 'Gmate script' of GMATE package
# sublime script
# Original Author: Alexandre da Silva
# This script allows users to use sublime text editor
# without interrupting the current terminal session (opens in a new process)
import gconf
import sys
import urllib
import os
#from optparse import OptionParser
# Get the last option as file
path = os.path.abspath(sys.argv[-1:][0])
if len(sys.argv) > 1:
parameters = ' '.join(sys.argv[1:-1])
if os.path.isdir(path:(
url = "file://%s" % urllib.quote(path)
config.set_string(os.path.join(base,'virtual_root'), url)
else:
parameters += ' "%s"' % path
os.system('nohup sublime ' + parameters + ' > /dev/null 2>&1 &')
else:
os.system('nohup sublime > /dev/null 2>&1 &')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment