" ShowTrailingWhitespace.vim: Detect unwanted whitespace at the end of lines. " " DEPENDENCIES: " " Copyright: (C) 2012 Ingo Karkat " The VIM LICENSE applies to this script; see ':help copyright'. " " Maintainer: Ingo Karkat " " REVISION DATE REMARKS " 1.00.004 06-Mar-2012 Toggle to value 2 when enabled but the buffer is " filtered from showing trailing whitespace. " 003 05-Mar-2012 Introduce g:ShowTrailingWhitespace_FilterFunc to " disable highlighting for non-persisted and " nomodifiable buffers. " 002 02-Mar-2012 Introduce b:ShowTrailingWhitespace_ExtraPattern " to be able to avoid some matches (e.g. a " in column 1 in a buffer with filetype=diff) and " ShowTrailingWhitespace#SetLocalExtraPattern() to " set it. " 001 25-Feb-2012 file creation let s:save_cpo = &cpo set cpo&vim function! ShowTrailingWhitespace#Pattern( isInsertMode ) return (exists('b:ShowTrailingWhitespace_ExtraPattern') ? b:ShowTrailingWhitespace_ExtraPattern : '') . \ (a:isInsertMode ? '\s\+\%#\@ 1 ? 0 : 2) endif endif call ShowTrailingWhitespace#Set(l:newState, a:isGlobal) endfunction function! ShowTrailingWhitespace#SetLocalExtraPattern( pattern ) let b:ShowTrailingWhitespace_ExtraPattern = a:pattern call s:DetectAll() endfunction " vim: set ts=8 sts=4 sw=4 noexpandtab ff=unix fdm=syntax :