Created
October 1, 2013 20:46
-
-
Save jimklo/6784840 to your computer and use it in GitHub Desktop.
Sublime Text 2 Path Hack
This file contains 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
import sublime, sublime_plugin | |
import os | |
homebrew_path = [ | |
"/usr/local/bin", | |
"/usr/local/sbin" | |
] | |
class PathmasterCommand(sublime_plugin.TextCommand): | |
def __init__(self, view): | |
sublime_plugin.TextCommand.__init__(self, view) | |
path_pieces = os.environ['PATH'].split(":") | |
new_path = [] | |
def append_path(bit): | |
if bit != "" and bit not in new_path: | |
new_path.append(bit) | |
for bit in path_pieces: | |
append_path(bit) | |
for bit in homebrew_path: | |
append_path(bit) | |
print ":".join(new_path) | |
os.environ['PATH'] = ":".join(new_path) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks! Worked like a charm!