Skip to content

Instantly share code, notes, and snippets.

@FerPerales
Last active February 28, 2018 01:15
Show Gist options
  • Save FerPerales/c32059fee6d10dc2a422362db2ed3ee0 to your computer and use it in GitHub Desktop.
Save FerPerales/c32059fee6d10dc2a422362db2ed3ee0 to your computer and use it in GitHub Desktop.
" Set max chars in column
set colorcolumn=110
" Colorize extra whitespaces at the end of a line
highlight ExtraWhitespace ctermbg=red guibg=red
match ExtraWhitespace /\s\+$/
autocmd BufWinEnter * match ExtraWhitespace /\s\+$/
autocmd InsertEnter * match ExtraWhitespace /\s\+\%#\@<!$/
autocmd InsertLeave * match ExtraWhitespace /\s\+$/
" Auto delete whitespaces on save
autocmd BufWritePre * :%s/\s\+$//e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment