Skip to content

Instantly share code, notes, and snippets.

@Cediddi
Created April 22, 2013 06:50
Show Gist options
  • Save Cediddi/5432900 to your computer and use it in GitHub Desktop.
Save Cediddi/5432900 to your computer and use it in GitHub Desktop.
A script for enabling autocomplete in OSX terminal. It also creates a function called clear() to clear screen.
import os, subprocess
pyrcfile = file(os.getenv("HOME")+"/.pythonrc","w")
pyrcfile.write("""import rlcompleter
import readline
import os
readline.parse_and_bind ("bind ^I rl_complete")
def clear():
os.system('clear')""")
pyrcfile.close()
try:
bashrcfile = file(os.getenv("HOME")+"/.bash_profile", "a")
except:
bashrcfile = file(os.getenv("HOME")+"/.bash_profile", "w")
bashrcfile.write("\nexport PYTHONSTARTUP=~/.pythonrc")
bashrcfile.close()
subprocess.call("source ~/.bash_profile",shell=True)
subprocess.call("killall Terminal",shell=True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment