bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[OFFTOPIC] spaces instead of tabs in vim [WAS Re: [PATCH 2/7] gnulib-too


From: Gary V. Vaughan
Subject: [OFFTOPIC] spaces instead of tabs in vim [WAS Re: [PATCH 2/7] gnulib-tool: transform hard-coded libgnu.a to $libname.l?a]
Date: Wed, 13 Oct 2010 18:28:12 +0700

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 (address@hidden)

Attachment: PGP.sig
Description: This is a digitally signed message part


reply via email to

[Prev in Thread] Current Thread [Next in Thread]