Setting Up and Using Vim for Python / Django Development

There are a lot of text editors and IDEs for a popular language such as Python, and we’ve already featured Eclipse/PyDev before. Today, we’ll focus on Vim, a highly configurable text editor built to enable efficient text editing. From the Vim website:

Vim is often called a “programmer’s editor,” and so useful for programming that many consider it an entire IDE. It’s not just for programmers, though. Vim is perfect for all kinds of text editing, from composing email to editing configuration files.

We’ll go through the installation and Python/Django-specific configuration through different levels, and depending on where you stop, you’ll get either a simple text editor, a full-blown IDE, or something in between.

 

Easy Level: Installation

Assuming you are using Ubuntu: sudo apt-get install vim

For other operating systems: http://www.vim.org/download.php

Once you’re done, running vim with a file will show something like this:

tumblr_m6aw4qNVQe1qcbckf

 

Normal Level: Basic Config

Most of our configuration will happen in your vimrc file. Check the wiki entry for this.

The basics would be:

The result of that config will look like this:

tumblr_m6aw7pAhIR1qcbckf

Interlude:

The wonder of vim is that from here on, you’re best left on your own to try out the different modes, configurations and plugins that will match your workflow. And the corollary wonder is that whenever you see a tip about vim, you’re learning something new. To point you to some resources:

 

Hard Level: Advanced Config

If you’re looking for Here are some links to existing guides for using Vim as a Python/Django IDE, in order of Django-specificness:

Going through this will result in an IDE-like environment as shown in the image in the Vim as Python IDE post:

vim-as-python-ide