diff options
author | Martin Kolman <mkolman@redhat.com> | 2013-07-16 16:35:12 +0200 |
---|---|---|
committer | Martin Kolman <mkolman@redhat.com> | 2013-07-16 16:35:12 +0200 |
commit | 856f581114f676e1093e64c145af0e128dc8c9e3 (patch) | |
tree | 63b798c5358f4198728e0c6cb042550f740edc9a /autoload/ShowTrailingWhitespace/Filter.vim | |
download | vim-856f581114f676e1093e64c145af0e128dc8c9e3.tar.gz vim-856f581114f676e1093e64c145af0e128dc8c9e3.tar.xz vim-856f581114f676e1093e64c145af0e128dc8c9e3.zip |
Diffstat (limited to 'autoload/ShowTrailingWhitespace/Filter.vim')
-rw-r--r-- | autoload/ShowTrailingWhitespace/Filter.vim | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/autoload/ShowTrailingWhitespace/Filter.vim b/autoload/ShowTrailingWhitespace/Filter.vim new file mode 100644 index 0000000..2f0dc20 --- /dev/null +++ b/autoload/ShowTrailingWhitespace/Filter.vim @@ -0,0 +1,30 @@ +" ShowTrailingWhitespace/Filter.vim: Exclude certain buffers from detection. +" +" DEPENDENCIES: +" +" Copyright: (C) 2012 Ingo Karkat +" The VIM LICENSE applies to this script; see ':help copyright'. +" +" Maintainer: Ingo Karkat <ingo@karkat.de> +" +" REVISION DATE REMARKS +" 1.00.002 06-Mar-2012 Modularize conditionals. +" Also do not normally show 'binary' buffers. +" 001 05-Mar-2012 file creation + +function! s:IsPersistedBuffer() + return ! (&l:buftype ==# 'nofile' || &l:buftype ==# 'nowrite') +endfunction +function! s:IsScratchBuffer() + return (bufname('') =~# '\[Scratch]') +endfunction +function! s:IsForcedShow() + return (ShowTrailingWhitespace#IsSet() == 2) +endfunction + +function! ShowTrailingWhitespace#Filter#Default() + let l:isShownNormally = &l:modifiable && ! &l:binary && (s:IsPersistedBuffer() || s:IsScratchBuffer()) + return l:isShownNormally || s:IsForcedShow() +endfunction + +" vim: set ts=8 sts=4 sw=4 noexpandtab ff=unix fdm=syntax : |