Skip to content

Instantly share code, notes, and snippets.

@jimklo
Created October 1, 2013 20:46
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 jimklo/6784840 to your computer and use it in GitHub Desktop.
Save jimklo/6784840 to your computer and use it in GitHub Desktop.
Sublime Text 2 Path Hack
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)
@sjardim
Copy link

sjardim commented Dec 5, 2013

Thanks! Worked like a charm!

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