Another Japan in the World

Jun Aruga's blog.

vimrc for Python development

I installed flake8 command by hacking module last time to do lint for Python code. such as "perl -c".

Following vimrc setting means

  • Individual vim settings for Python file (*.py).
  • Run $ flake8 by F1 in the Vim.
  • Run $ python by F2 in the Vim.
$ vi ~/.vimrc

" Python
autocmd FileType python set tabstop=4|set shiftwidth=4|set expandtab|set softtabstop=4
autocmd FileType python :map <F1> <ESC>:!flake8 %<CR>
autocmd FileType python :map <F2> <ESC>:!python %<CR>