Enabling Tab Auto-Completion For Python
The
Python Standard Library Reference on rlcompleter
provides everything you need.
Following the directions there here's what I did.
- Make a directory in your
home
directory
~$ mkdir .pythonrc
- Create a file in your new directory with the following lines
~/.pythonrc$ vim pythonstartup.py
#! /usr/bin/env python
try:
import readline
except ImportError:
print "Module readline not available."
else:
import rlcompleter
readline.parse_and_bind("tab: complete")
- Add the following line to your
.bashrc
file
export PYTHONSTARTUP=~/.pythonrc/pythonstartup.py
- restart your shell and start python
No comments:
Post a Comment