If you use the vim editor, this web pages suggest some useful configuration options.
- What to do about Tab Characters?
- Removing Trailing Whitespace
I would like to propose the following as a standard practice for Mu2e:
Please configure your editor(s) so that they do not write tab characters to source code
files. Please do configure your editor so that, when you hit the tab key, it inserts the
appropriate number of spaces to achieve the desired formatting.
The short answer is:
- To change all existing tab characters into spaces so as to match the current tab stop
settings, use the 'retab' command. The default tab stops are very 8 columns,
but that can be changed by setting the 'tabstop' option to something other than 8.
- Set the 'expandtab' (abbreviated to 'et') option to convert each tab automatically as
you type it into a number of spaces. You can set this option in your ~/.vimrc file.)
Once this option is set, use Ctrl-V if you want to enter a real tab character.
For more details see the discussion on configuring editors not to use tabs.
- To remove trailing whitespace, use the following command: %s/\s\+$//
- To remove trailing whitespace automatically when writing a file, put the following in your ~/.vimrc file:
autocmd BufWritePre * :%s/\s\+$//e
Some people don't use vim autocommands because every so often they need finer control.
This file last modified Thursday, 26-Jan-2012 17:58:43 CST