Hi folks, I just added a small tool to the tools/ directory in src called fixwhite(1) that attempts to fix commonly made whitespace bugs in source files. I wrote it in such a way that it's quite conservative, to make sure it won't make too many annoying changes that you have to roll back manually. It should be useful especially when copy-pasting code between terminals.
As mentioned in the commit message, you can just use :%!fixwhite if you're a vi(1) user. Other editors probably support a similar construct. Have fun! -- Ed Schouten <e...@80386.nl> WWW: http://80386.nl/ ----- Forwarded message from Ed Schouten <e...@freebsd.org> ----- > Date: Mon, 6 Feb 2012 10:23:11 +0000 (UTC) > From: Ed Schouten <e...@freebsd.org> > To: src-committ...@freebsd.org, svn-src-...@freebsd.org, > svn-src-h...@freebsd.org > Subject: svn commit: r231071 - head/tools/tools/fixwhite > > Author: ed > Date: Mon Feb 6 10:23:11 2012 > New Revision: 231071 > URL: http://svn.freebsd.org/changeset/base/231071 > > Log: > Add fixwhite(1). > > This small utility can be used to `sanitize' the whitespace in source > code. It does the following things: > > Global: > - Remove empty lines at the beginning and the end of a file. > - Merge successive empty lines into a single empty line. > > Per-line: > - Remove trailing whitespace. > - Merge spaces preceeding tabs into the tabs. > > It operated on stdin/stdout. This means that if you use vi(1), you can > just run :%!fixwhite to reorganize the file. ----- End forwarded message -----
pgpL2cPVW0sdr.pgp
Description: PGP signature