How do I set up Vim autoindentation properly for editing Python files?
I use this on my macbook:
" configure expanding of tabs for various file typesau BufRead,BufNewFile *.py set expandtabau BufRead,BufNewFile *.c set expandtabau BufRead,BufNewFile *.h set expandtabau BufRead,BufNewFile Makefile* set noexpandtab" --------------------------------------------------------------------------------" configure editor with tabs and nice stuff..." --------------------------------------------------------------------------------set expandtab " enter spaces when tab is pressedset textwidth=120 " break lines when line length increasesset tabstop=4 " use 4 spaces to represent tabset softtabstop=4set shiftwidth=4 " number of spaces to use for auto indentset autoindent " copy indent from current line when starting a new line" make backspaces more powerfullset backspace=indent,eol,startset ruler " show line and column numbersyntax on " syntax highlightingset showcmd " show (partial) command in status line
(edited to only show stuff related to indent / tabs)
I use:
$ cat ~/.vimrcsyntax onset showmatchset ts=4set sts=4set sw=4set autoindentset smartindentset smarttabset expandtabset number
But but I'm going to try Daren's entries
A simpler option: just uncomment the following part of the configuration (which is originally commented out) in the /etc/vim/vimrc file:
if has("autocmd") filetype plugin indent on endif