(original) (raw)

Index: Misc/Vim/vimrc =================================================================== --- Misc/Vim/vimrc (revision 70732) +++ Misc/Vim/vimrc (working copy) @@ -21,8 +21,16 @@ " Python: 4 spaces " C: 8 spaces (pre-existing files) or 4 spaces (new files) au BufRead,BufNewFile *.py,*pyw set shiftwidth=4 -au BufRead *.c,*.h set shiftwidth=8 -au BufNewFile *.c,*.h set shiftwidth=4 +fu Select_c_style() + if search('^\t') + set shiftwidth=8 + set noexpandtab + el + set shiftwidth=4 + set expandtab + en +endf +au BufRead,BufNewFile *.c,*.h call Select_c_style() " Number of spaces that a pre-existing tab is equal to. " For the amount of space used for a new tab use shiftwidth. @@ -36,7 +44,6 @@ " C: no " Makefile: no au BufRead,BufNewFile *.py,*.pyw set expandtab -au BufRead,BufNewFile *.c,*.h set noexpandtab au BufRead,BufNewFile Makefile* set noexpandtab " Use the below highlight group when displaying bad whitespace is desired