1. Set the below parameters in /etc/vimrc to activate auto indent and other stuff
filetype plugin indent on
set cindent
autocmd FileType python setlocal foldmethod=indent smartindent shiftwidth=4 ts=4 et cinwords=if,elif,else,for,while,try,except,finally,def,class
2.Set autocmd to run python script from vim itself edit /etc/vimrc and add following line (F9 and ENTER to execute). ” :w !python” would do without autocmd
autocmd FileType python nnoremap <buffer> <F9> :exec ‘!python’ shellescape(@%, 1)<cr>