Using ipython mode in emacs

Using ipython in emacs is very useful because of the advantages in debugging and having everything in one environment. To do so, just download http://ipython.scipy.org/dist/ipython.el

To use, add the following lines in your .emacs file:

(add-to-list 'interpreter-mode-alist '("python" . python-mode))
(require 'ipython)
(setq load-path (cons "~/directory with ipython.el/" load-path))
(setq ipython-command "path to/ipython")

To start the ipython shell, use C-c ! from a .py file or from the menu bar. Shortcut to run the .py file C-c C-c or C-c RET.

By default, to scroll up and down the history for ipython is ctrl+up or ctrl+down, but can be changed to just up and down using:


(require 'comint)
(define-key comint-mode-map [(up)]
'comint-previous-matching-input-from-input)
(define-key comint-mode-map [(down)]
'comint-next-matching-input-from-input)

More instructions can be found here and here.

Leave a Reply

Your email address will not be published. Required fields are marked *