--- /dev/null
+---
+title: vim-whitespace
+homepage: https://webinstall.dev/vim-whitespace
+tagline: |
+ vim whitespace sets tab, whitespace, trailing whitespace rules to reasonable values
+---
+
+To update (replacing the current version) run `webi vim-whitespace`.
+
+## Cheat Sheet
+
+The idea that tabs should be 8 spaces wide is redonkulous.
+
+This vim-whitespace plugin sets tabs to spaces (4 wide), trim trailing
+whitespace, and makes whitespace handling consistent.
+
+### How to configure manually
+
+Create the file `~/.vim/plugins/whitespace.vim`. Add the same contents as
+<https://github.com/webinstall/webi-installers/blob/master/vim-whitespace/whitespace.vim>.
+
+That will look something like this:
+
+```vim
+" handle tabs as 4 spaces, in every direction, consintently
+set tabstop=4
+set shiftwidth=4
+set smarttab
+set expandtab
+set softtabstop=4
+
+" remove trailing whitespace on save
+autocmd BufWritePre * :%s/\s\+$//e
+```
+
+You'll then need to update `~/.vimrc` to source that plugin:
+
+```vim
+" Tabs & Whitespace: reasonable defaults from webinstall.dev/vim-whitespace
+source ~/.vim/plugins/whitespace.vim
+```
--- /dev/null
+#!/bin/bash
+
+function __init_vim_whitespace() {
+ set -e
+ set -u
+
+ mkdir -p "$HOME/.vim/plugins"
+ rm -rf "$HOME/.vim/plugins/whitespace.vim"
+
+ echo ""
+
+ if [ ! -e "$HOME/.vimrc" ]; then
+ touch "$HOME/.vimrc"
+ fi
+
+ if ! [ -f "$HOME/.vim/plugins/whitespace.vim" ]; then
+ mkdir -p ~/.vim/plugins
+ WEBI_HOST=${WEBI_HOST:-"https://webinstall.dev"}
+ curl -fsS -o ~/.vim/plugins/whitespace.vim "$WEBI_HOST/packages/vim-whitespace/whitespace.vim"
+ fi
+
+ if ! grep 'source.*plugins.whitespace.vim' -r ~/.vimrc > /dev/null 2> /dev/null; then
+ set +e
+ mkdir -p ~/.vim/plugins
+ printf '\n" Tab & Whitespace: reasonable defaults from webinstall.dev/vim-whitespace\n' >> ~/.vimrc
+ printf 'source ~/.vim/plugins/whitespace.vim\n' >> ~/.vimrc
+ set -e
+ echo "added ~/.vim/plugins/whitespace.vim"
+ echo "updated ~/.vimrc with 'source ~/.vim/plugins/whitespace.vim'"
+ echo ""
+ fi
+
+ echo "Vim's has been updated with reasonable whitespace settings."
+}
+
+__init_vim_whitespace
--- /dev/null
+" The default tab width is 8 spaces, which is redonkulous.
+" We'll set it to 4 instead, which is reasonable.
+" (feel free to change to 2, but 3 is right out).
+"
+" Also, I'm not actually sure what the individual options do,
+" but it's something like 'always use spaces' and
+" 'use the same width when typing, tabbing, deleting, moving, etc'
+set tabstop=4
+set shiftwidth=4
+set smarttab
+set expandtab
+set softtabstop=4
+
+" remove trailing whitespace on save
+autocmd BufWritePre * :%s/\s\+$//e