Thursday, January 31, 2013

Vim for Python Development

Testing a PyOpenCL demo in vim.

This is my collection of hacks that turn vim into a python IDE.

Syntax Highlighting

I'm using Arch Linux and Syntax Highlighting comes installed with my Vim package. I just need to enable the syntax highlighting in my .vimrc file:

Enable line numbers

Is as simple as adding this line to the .vimrc


Adding this to the .vimrc file will enable PEP8 indentation only for *.py files.


I use the great jedi-vim plugin from David Halter and the SuperTab plugin. You can find the installation steps at RedKrieg's post: Writing Python like a Jedi.

Testing the jedi-vim plugin

Executing python code inside vim

This is my favorite, press the F5 key to save the python script and execute it. Add this to the .vimrc file.

Enable file specific features

To enable all the filetype features I've defined above the following lines are needed in the .vimrc file.

Other plugins

Here is a collection of other useful plugins, I recommend installing them using pathogen if you can't get them from the repositories of your Linux distro.

If you have hacks of your own, please share them with everyone in the comments section.


  1. I recently came across your blog and have been reading along. I thought I would leave my first comment. I don't know what to say except that I have enjoyed reading. Nice blog.

  2. Nice blog..! I really loved reading through this article. Thanks for sharing such a
    amazing post with us and keep blogging... best angularjs training institute in chennai | angularjs training in omr | .angular 4 training in chennai | angularjs training in omr

  3. This is often simply what I would like to say when commenting on a newspaper. Looking forward to several interesting and useful articles from you. The article is incredibly intensive and effective.

  4. Hiiii...Thanks for sharing Great info...Nice post...Keep move on...
    Python Training in Hyderabad