Skip to content

Instantly share code, notes, and snippets.

@tsurushuu
Created December 12, 2011 14:47
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tsurushuu/1467584 to your computer and use it in GitHub Desktop.
Save tsurushuu/1467584 to your computer and use it in GitHub Desktop.
for Sublime Text 2
###########################
# windows only
###########################
#import sublime
import sublime_plugin
import os
import os.path
class OpenInDefaultCommand(sublime_plugin.TextCommand):
def run(self, edit):
os.system(self.view.file_name())
class CmdWindowHereCommand(sublime_plugin.TextCommand):
def run(self, edit):
path = self.view.file_name()
dirPath = os.path.dirname(path)
cmd = 'start /D"%(dirPath)s"' % {'dirPath': dirPath}
#print cmd
os.system(cmd)
cygBinPath = 'c:\\cygwin\\bin'
def to_cygpath(path):
return os.popen('%(cygBinPath)s\\cygpath "%(path)s"' % {'cygBinPath': cygBinPath, 'path': path}).read().rstrip()
class BashPromptHereCommand(sublime_plugin.TextCommand):
def run(self, edit):
path = self.view.file_name()
dirPath = os.path.dirname(path)
cP = to_cygpath(dirPath)
cmd = 'start %(cygBinPath)s\\bash --login -i -c "cd \\"%(cP)s\\"; exec bash"' % {'cygBinPath': cygBinPath, 'cP': cP}
#print cmd
os.system(cmd)
@nfarrar
Copy link

nfarrar commented May 30, 2013

Hello - I'm trying to get Sublime Text 2 to build in my cygwin environment. It looks like you may have figured it out, but I'm not exactly sure how to use this. Any chance you could help me out? :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment