This post is for Vi users that may find frustrating programming Python without a mouse cursor to help on indentation and block selection. The tricks are to set these environmental variables on Vi:
autocmd BufRead *.py \
set expandtab \
set tabstop=4 \
set shiftwidth=4 \
set smarttab \
set softtabstop=4 \
set autoindent \
set textwidth=110
autocmd BufRead *.py set smartindent \
inwords=if,elif,else,for,while,try,except,finally,def,class
So if you put this on your ~/.vimrc you should get a Vi that is Python friendly every time you edit a *.py file.
Essentially these options will make tabs become 4 spaces and add auto-indentation after keywords of python (if, while, do, try, etc...). For more info on each command type on Vi ':help
Have fun!
Thanks !
ReplyDelete:)
Really Helpful.