By continuing to navigate on this website, you accept the use of cookies to serve you more relevant services & content.
For more information and to change the setting of cookies on your computer, please read our Cookie Policy.

Vim for Python Web Development

Having a good environment setup is important for effective, fast and easy coding.
We have different IDE's like eclipse, pycharm, sublime etc.. which are powerful and easy to use.

IDE's like eclipse, pycharm, sublime etc.. are resource intensive as they run many features, this is not a problem if you have really great system with powerfull resources.

So, Why bother with VIM:
    1. Vim has unique key bindings which makes typing really fast and easy.
    2. Vim key bindings makes hand movement at the least.
    3. Vim is very light and very fast.

Vim is a simple plain editor but for easy coding we need features like autocompletion, code checker and project navigation. To implement these there are different plugins.

Before we install plugins lets setup vim with basic configuration.

Install vim using your package manager:

Ubuntu: apt-get install vim
ArchLinux: pacman -S vim

Vim uses ~/.vimrc file for configuration settings. Copy the following to ~/.vimrc file

execute pathogen#infect()                                                          " run pathogen plugin
syntax on                                                                          " Highlights syntax like variables, names, classes etc..
filetype on                                                                        " Useful for detecting files and changing rules
filetype plugin on
filetype plugin indent on
set backspace=indent,eol,start                                                     " Indent on hitting backspace
set expandtab                                                                      " enter spaces when tab is pressed
set tabstop=4                                                                      " use 4 spaces to represent tab
set softtabstop=4
set shiftwidth=4                                                                   " number of spaces to use for auto indent
set autoindent                                                                     " copy indent from current line when starting a new line
set pastetoggle=                                                              " press f10 and paste or else it will be a mess
set ignorecase                                                                     " ignore case when searching
au FileType python setl sw=4 sts=4 et                                              " .py files, specific rules
au FileType html setl sw=2 sts=2 et                                                " .html files, specific rules


Install Plugins:

Why: It handles all the plugins we install, recomended way to install plugins.


mkdir -p ~/.vim/autoload ~/.vim/bundle && \
curl -LSso ~/.vim/autoload/pathogen.vim

which creates ~/.vim/bundle and ~/.vim/autoload directories and copies pathogen.
Add the following line at the beginning in your ~/.vimrc file(neglect if already present)

execute pathogen#infect()


Why: Its a python code checker, checks the code when we write to file and highlights the errors.

Go to and download file then extract it to ~/.vim/bundle/ directory.

Paste the following to ~/.vimrc file(neglect if present already).

filetype on            " enables filetype detection
filetype plugin on     " enables filetype specific plugins



Why: Its the python autocompletion library, suggests python modules as you type.


cd ~/.vim/bundle/ && git clone --recursive



Why: Helps in navigating through project, uses fuzzy logic, so no need to remember exact file name.


cd ~/.vim
git clone bundle/ctrlp.vim



Why: Displays beautiful status of current file like its path, vim mode, current line number. Indeed not required if you are minimalist


git clone ~/.vim/bundle/vim-airline

In my opinion installing different plugins will be flexible but adds complexity and makes vim slow, so the above plugins(excluding vim-airline) is all we need for effective, fast and easy coding

    Posted On
  • 20 October 2011
  • By
  • Micropyramid

Need any Help in your Project?Let's Talk

Latest Comments
Related Articles
Working with python collections part 1

Python Collections - named tuple is to access by the names specified and deque is to append and pop the elements from both sides of ...

Continue Reading...
Publishing Python Modules with PIP via PyPi

We'll install so many packages in our day to day python development. Now in this blog post, we'll try to know how to create our ...

Continue Reading...
How to generate PDF Files from HTML In Python using PDFKIT

There are many approches for generating PDF in python. pdfkit is one of the better approache as, it renders HTML into PDF with various image ...

Continue Reading...
open source packages

Subscribe To our news letter

Subscribe and Stay Updated about our Webinars, news and articles on Django, Python, Machine Learning, Amazon Web Services, DevOps, Salesforce, ReactJS, AngularJS, React Native.
* We don't provide your email contact details to any third parties