Created
December 12, 2011 14:47
-
-
Save tsurushuu/1467584 to your computer and use it in GitHub Desktop.
for Sublime Text 2
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
########################### | |
# 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) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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? :)