Last Updated: June 07, 2018
· mayuroks

OSX ipython ctrl right / left navigation

In OS X ipython shell navigation was a pain coz I couldn't navigate/skip one word forward or backward using CTRL-RIGHT / LEFT arrows. Whenever I tried doing it I would see such characters.

In [1]: celery papaya;5D;5D;5D;5C;5C;5C

A QUICK WAY TO FIX this is by installing readline and configuring .inputrc.

1) Install readline using brew

$ brew install readline

2) TRICK LIES HERE. Find which characters are sent to ipython notebook when you press CTRL-RIGHT / LEFT.

Press CTRL-V and CTRL-RIGHT. In my case it showed


REPEAT for left arrow. Press CTRL-V and CTRL-LEFT.


3) Finally, your ~/.inputrc should look like

$ cat ~/.inputrc
# ipython settings
"\e[1;5D": backward-word
"\e[1;5C": forward-word

4) Enjoy ! CTRL-RIGHT and CTRL-LEFT works now.

Some References:

2 Responses
Add your response

I just tested this and Control didn't work but Alt/Option did by default. I'm on Python 2.7 with OS X 10.10.4. Might make life easier on you. Hope this helps.

over 1 year ago ·