A suitable vimrc for python

1 minute read Published:

Since i find myself in a lot of trouble when going to a new linux system due to misconfigured vim i thought

i might share with you my tipical default configuration for vim that is good for developing in python

here are the main lines, since i use a dark background i like a lot the “background=dark” feature

set compatible
syntax on
set background=dark
if has("autocmd")
  au BufReadPost * if line("'\"") > 0 && line("'\"") < = line("$")
    \| exe "normal g'\"" | endif
endif

set showcmd             
set showmatch           
set incsearch           

autocmd FileType python set tabstop=4|set shiftwidth=4|set expandtab " Python
autocmd FileType make set tabstop=8|set shiftwidth=8|set noexpandtab " Makefile
autocmd FileType man set tabstop=8|set shiftwidth=8|set noexpandtab " Man page (also used by psql to edit or view)
autocmd FileType calendar set tabstop=8|set shiftwidth=8|set noexpandtab

I hope this will help you too