sponsor Vim development Vim logo Vim Book Ad

WhiteWash : Add and remove whitespace with strong opinions

 script karma  Rating 3/3, Downloaded by 1535  Comments, bugs, improvements  Vim wiki

created by
Michael O'Neill
script type
# Features

* Removes whitespace at the end of lines.
* Removes sequential whitespace between words.
* Ignores whitespace at the beginning of a line (to preserve indents).
* Adds spaces after commas in non-numeric strings.
* Changes `foo(bar,baz,boo)` to `foo(bar, baz, boo)`.
* Ignores large numbers (e.g. `1,234,456,789`), but not `foo(0,1)`.
* Operates on the entire buffer by default, or a range if provided.
* Aggressive mode for when you know better than the safeguards.

# Options

* `g:WhiteWash.auto` - Enabled rules are run whenever `:WhiteWash` is called.
" Set to 0 to disable a rule
let g:WhiteWash.auto.commas = 0
let g:WhiteWash.auto.sequential = 0
let g:WhiteWash.auto.trailing = 0

* `g:WhiteWash.aggressive` - Define which rules should run with aggressive mode
  by default.
let g:WhiteWash.aggressive.commas = 1
let g:WhiteWash.aggressive.sequential = 1

# Commands

* `:WhiteWash` - Run all enabled WhiteWash rules.
* `:WhiteWashAggressive` - Run all enabled WhiteWash rules in aggressive mode.
* `:WhiteWashCommas` - Run only the commas rule (respects aggressive setting).
* `:WhiteWashSequential` - Run only the sequential rule (respects aggressive
* `:WhiteWashTrailing` - Remove trailing whitespace.
install details
Extract to your `$HOME/.vim/` directory.

rate this script Life Changing Helpful Unfulfilling 
script versions (upload new version)

Click on the package to download.

package script version date Vim version user release notes
WhiteWash.zip 2.0.0 2018-03-27 7.0 Michael O'Neill - Change the general flow of how operations occur in order to be more
  modular and more customizable.
- Add documentation (see `:help whitewash`).
- Rework how the `:WhiteWashCommas` command works.
WhiteWash.vim 1.2 2014-09-08 7.3 Michael O'Neill Add WhiteWashTrailing function and command
- Allow users to call :WhiteWashTrailing to clean only whitespace at the end of lines.
- Stop trying to handle trailing ^Ms. This is caused by using the DOS file format when one should be using the Unix format.
- Remove the space between the words white and space (oh, the irony).
WhiteWash.vim 0.11 2012-02-03 7.3 Michael O'Neill Add GetLatestVimScript support.
WhiteWash.vim 0.1 2012-02-03 7.3 Michael O'Neill Initial upload
ip used for rating:

If you have questions or remarks about this site, visit the vimonline development pages. Please use this site responsibly.
Questions about Vim should go to the maillist. Help Bram help Uganda.