[IPython-dev] Code Indentation and Tab Completion

Fernando Perez Fernando.Perez at colorado.edu
Wed Nov 10 02:43:50 EST 2004

Donny Viszneki wrote:
> I'm using Mac OS X, and in every terminal I use, when I press tab to 
> indent for a block of code, iPython instead tries to tab complete, and 
> consequently asks me if I really want to see every possible tab 
> completion.
> What's the problem here? I have the source code so I was thinking about 
> taking a look. Does iPython use curses?

It's a feature :)

No, ipython doesn't use curses, but it uses GNU readline and configures it for 
tab-completion.  Most users (myself included) prefer the tab key to do 
completions rather than indentation when working interactively.  But like all 
things ipython, you can change this to suit your personal taste.  Look at the 
~/.ipython/ipythonrc file for all of ipython's configuration options, in 
particular see the readline section.  If you simply comment out the 
readline_parse_and_bind tab: line, the tab key will be left alone.

Note that ipython, as it rebinds tab for completions, also rebinds the following:

readline_parse_and_bind "\C-o": tab-insert
readline_parse_and_bind "\M-i": "    "
readline_parse_and_bind "\M-o": "\d\d\d\d"
readline_parse_and_bind "\M-I": "\d\d\d\d"

(the \d means backspace in readline parlance).  This hopefully gives you 
enough options for a normal workflow, keeping the power of tab-completion 
active (which most of us simply can't live without).



More information about the IPython-dev mailing list