Skip to content

Instantly share code, notes, and snippets.

@niklas88
Last active July 3, 2018 09:48
Show Gist options
  • Save niklas88/ebbb2b01a78e3c91999021803da5ffb9 to your computer and use it in GitHub Desktop.
Save niklas88/ebbb2b01a78e3c91999021803da5ffb9 to your computer and use it in GitHub Desktop.
" Show tabs, End-of-Line and Trailing spaces
set listchars=tab:▸\ ,eol:¬,trail:~
" So the background is transparent for the above characters
highlight Normal ctermbg=none
highlight NonText ctermbg=none
" Whitespace at end of line in red
highlight ExtraWhitespace ctermbg=red guibg=red
match ExtraWhitespace /\s\+$/
autocmd BufWinEnter * match ExtraWhitespace /\s\+$/
autocmd InsertEnter * match ExtraWhitespace /\s\+\%#\@<!$/
autocmd InsertLeave * match ExtraWhitespace /\s\+$/
autocmd BufWinLeave * call clearmatches()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment