Python Bibliotheca
Python resources for teachers and students.

Using vim as a Python IDE

Here is a little .vimrc that makes vim an excellent Python IDE:

" .vimrc
"
" Created by Jeff Elkner 23 January 2006
" Last modified 11 July 2011
"
" Turn on syntax highlighting and autoindenting
syntax enable
filetype indent on
" set autoindent width to 4 spaces
set et
set sw=4
set smarttab
" Bind <f2> key to running the python interpreter on the currently active
" file.  (courtesy of Steve Howell from email dated 1 Feb 2006).
" The second line binds <f3> to running python3 on a GNU/Linux system,
" like Ubuntu or Fedora, that use python3 to launch Python 3.
map <f2> :w\|!python %<cr>
map <f3> :w\|!python3 %<cr>

Click here to download this file. Rename as .vimrc and put it in your home directory.

[ Copyright 2006, Jeffrey Elkner ]

Comments, questions, or suggestions? Email the webmaster