I did vim conf for Python

Posted by admin on March 5th, 2010 filed in Uncategorized

Now a day I got interest on Python programming, when I start write program in vim I am keep on facing indentation error problem. Really I am not able to concentrate on tabs and number of spaces thats why I configured my vim Editor for .py files. Now it is working pretty good. Really vim is like a gelly chacolate, we can mould as per our wish.

For python I added the below text to the .vimrc file. .vimrc is located at ~/.vimrc(Home directory).

set term=builtin_ansi
syntax on
autocmd BufRead *.py set smartindent cinwords=if,elif,else,for,while,try,except,finally,def,class
autocmd BufRead *.py inoremap # X^H#
autocmd BufRead *.py set tabstop=4
autocmd BufRead *.py set shiftwidth=4
autocmd BufRead *.py set smarttab
autocmd BufRead *.py set expandtab
autocmd BufRead *.py set softtabstop=4
autocmd BufRead *.py set autoindent
autocmd BufRead *.py highlight BadWhitespace ctermbg=red guibg=red
autocmd BufRead *.py match BadWhitespace /^\t\+/
autocmd BufRead *.py match BadWhitespace /\s\+$/
set incsearch
set ignorecase
set num
set history=1000

Now I am getting smart indentation for conditional blocks, loop blocks and even for classes and methods .


One Response to “I did vim conf for Python”

  1. Kylie Batt Says:

    .. редко.. можно сказать, это исключение :) из правил…

    Now a day I got interest on Python programming, when I start write program in vim I am keep on facing indentation error problem…..

Leave a Comment