Another Japan in the World

Jun Aruga's blog, who lived in Japan, Singapore, live in Czech Republic. Mainly about IT and travel.

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 your_python_code.py by F1 in the Vim.
  • Run $ python your_python_code.py 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>
Remove all ads