Skip to content

Instantly share code, notes, and snippets.

Last active Jun 2, 2021
What would you like to do?
Step-by-step on setting up vim-flake8

This is how to automatically check your Python code style to comply with PEP8 when you use vim as your text editor. The first thing to do is, make sure you have vim running 😁

$ vim

You need to setup vim-pathogen first:

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

Add this to .vimrc file:

execute pathogen#infect()
filetype plugin indent on

Now copy vim-flake8 and put it at vim bundle directory:

$ cd ~/.vim/bundle && git clone

Add also add this to .vimrc to automatically check the style everytime you write a Python code:

autocmd BufWritePost *.py call Flake8()

Let's give it a try, create a Python file:

$ vim
import django
from datetime import datetime

now =

Try to save it: :w then you should see this kind of warning:|1 col 1| F401 'django' imported but unused 



Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment