diff --git a/.config/vim/vimrc b/.config/vim/vimrc index 5485a90..a4509b0 100644 --- a/.config/vim/vimrc +++ b/.config/vim/vimrc @@ -44,6 +44,8 @@ else endif " Copy structure of the existing lines indent when autoindenting a new line set copyindent +" Show ruler at 80 and 100 columns +set colorcolumn=80,100 " Keybindings ################################################################## " Set leader key @@ -105,10 +107,31 @@ if (has('nvim')) highlight NonText guibg=NONE endif +" Autocommands ################################################################# +" Shorter lines in git commits +autocmd filetype gitcommit set colorcolumn=50,72 +" Spell checking in git commits +autocmd filetype gitcommit set spell spelllang=en_us + " zshOption is a huge regex that leads to massive lags when scrolling " Be sure to disable it after activating syntax highlighting autocmd filetype zsh syntax clear zshOption +" Highlight trailing whitespaces +" (https://vim.fandom.com/wiki/Highlight_unwanted_spaces) +" Create highlight group +highlight ExtraWhitespace ctermbg=red guibg=red +" Associate with patter (trailing whitespaces) +match ExtraWhitespace /\s\+$/ +" apply not only to the first window +autocmd BufWinEnter * match ExtraWhitespace /\s\+$/ +" Do not match when typing at the end of a line +autocmd InsertEnter * match ExtraWhitespace /\s\+\%#\@