X-Git-Url: https://git.sthu.org/?a=blobdiff_plain;f=init.vim;h=17ed253a14c19622a4dd56b85cb84e69c5ef4eb5;hb=f091bc104c5dee219f1fd2b8f4ad677e78922e96;hp=e552eff7ff6769794875699c15e8e438a86ad925;hpb=e7fb4ebb2b445f37f03b9983d737b7345533863f;p=vimconf.git diff --git a/init.vim b/init.vim index e552eff..17ed253 100644 --- a/init.vim +++ b/init.vim @@ -48,11 +48,23 @@ runtime plugsetup.vim " Attention: Must be run after plugsetup.vim " Trailing whitespace highlight default link BadWhitespace SpellCap + +" Setup BadWhitespace syntax match expressions. +function SetBadWhitespaceSyntax() + " Do not expose bad whitespace in help buffers or for man pages. Or, more + " generally, if we open the file readonly. + "if &ft != "help" && &ft != "man" + if !&readonly + " Make trailing whitespace be flagged as bad. + syn match BadWhitespace /\s\+$/ containedin=ALL + " Make space before tab be flagged as bad and vice versa + syn match BadWhitespace / \+\t/ containedin=ALL + syn match BadWhitespace /\t \+/ containedin=ALL + endif +endfunction + " Make trailing whitespace be flagged as bad. -au BufRead,BufNewFile * syn match BadWhitespace /\s\+$/ containedin=ALL -" Make space before tab be flagged as bad and vice versa -au BufRead,BufNewFile * syn match BadWhitespace / \+\t/ containedin=ALL -au BufRead,BufNewFile * syn match BadWhitespace /\t \+/ containedin=ALL +au BufRead,BufNewFile * call SetBadWhitespaceSyntax() let g:airline_powerline_fonts=1 let g:airline#extensions#tabline#enabled=1