From e10ca02d0d60f4c00a68e1eda53a517714896db3 Mon Sep 17 00:00:00 2001 From: Scott Bronson Date: Wed, 11 Aug 2010 12:28:48 -0700 Subject: [PATCH] initial checkin --- README | 9 +++++++++ doc/trailing-whitespace.txt | 16 ++++++++++++++++ plugin/trailing-whitespace.vim | 11 +++++++++++ 3 files changed, 36 insertions(+) create mode 100644 README create mode 100644 doc/trailing-whitespace.txt create mode 100644 plugin/trailing-whitespace.vim diff --git a/README b/README new file mode 100644 index 0000000..e13a41d --- /dev/null +++ b/README @@ -0,0 +1,9 @@ +This plugin causes all trailing whitespace to be highlighted in red. + +To fix the whitespace errors, just call :FixWhitespace. By default it +operates on the entire file. Pass a range (or use V to select some lines) +to restrict the portion of the file that gets fixed. + +Based on http://vim.wikia.com/wiki/Highlight_unwanted_spaces , and +Thanks to http://github.com/graywh/dotfiles/blob/master/.vimrc#L452 +for improving the fix command. diff --git a/doc/trailing-whitespace.txt b/doc/trailing-whitespace.txt new file mode 100644 index 0000000..deb3cb9 --- /dev/null +++ b/doc/trailing-whitespace.txt @@ -0,0 +1,16 @@ +*trailing-whitespace.txt* trailing-whitespace + + +This plugin causes all trailing whitespace to be highlighted in red. + + + *FixWhitespace* + +To fix the whitespace errors, just call :FixWhitespace. By default it +operates on the entire file. Pass a range (or use V to select some lines) +to restrict the portion of the file that gets fixed. + +Based on http://vim.wikia.com/wiki/Highlight_unwanted_spaces , and +Thanks to http://github.com/graywh/dotfiles/blob/master/.vimrc#L452 +for improving the fix command. + diff --git a/plugin/trailing-whitespace.vim b/plugin/trailing-whitespace.vim new file mode 100644 index 0000000..9aa14ee --- /dev/null +++ b/plugin/trailing-whitespace.vim @@ -0,0 +1,11 @@ +" Highlight EOL whitespace, http://vim.wikia.com/wiki/Highlight_unwanted_spaces +highlight ExtraWhitespace ctermbg=darkred guibg=#382424 +autocmd ColorScheme * highlight ExtraWhitespace ctermbg=red guibg=red +autocmd BufWinEnter * match ExtraWhitespace /\s\+$/ +" the above flashes annoyingly while typing, be calmer in insert mode +autocmd InsertLeave * match ExtraWhitespace /\s\+$/ +autocmd InsertEnter * match ExtraWhitespace /\s\+\%#\@,substitute/\s\+$// +