Hmm... now I know why I prefer emacs! On 13 Oct 2010, at 16:40, Gary V. Vaughan wrote: > On 13 Oct 2010, at 03:26, Bruno Haible wrote: >> And, please, in gnulib code, we don't use tabs any more, except in pieces >> of Makefiles and ChangeLog. See the section "Indent with spaces, not TABs" >> of gnulib/README. > > Does vim have an equivalent to emacs' (setq-default indent-tabs-mode nil) > that I could paste into my .vimrc to save me from doing this again?
For the record, that would be:
" except in makefiles, always expand tabs into spaces; ^V-TAB for a real tab
set expandtab
autocmd FileType make setlocal noexpandtab
if &t_Co > 1
" always highlight trailing whitespace, and space-tab sequences
syntax on
highlight ExtraWhitespace ctermbg=red guibg=red
autocmd Syntax * syn match ExtraWhitespace /\s\+$\| \+\ze\t/ containedin=ALL
autocmd BufWinLeave * call clearmatches()
endif
And to fix a whole file of mangled tabs (when the above is in .vimrc already):
:retab
See also:
http://vim.wikia.com/wiki/Converting_tabs_to_spaces
Cheers,
--
Gary V. Vaughan ([email protected])
PGP.sig
Description: This is a digitally signed message part
