From 97260306fb43b9b13849aaa55faf965cbef3041c Mon Sep 17 00:00:00 2001 From: druckdev <63563978+druckdev@users.noreply.github.com> Date: Tue, 22 Sep 2020 13:34:43 +0200 Subject: [PATCH] vim: Reorder config and create autocommand section Move everything that is not strictly part of "Aesthetics" out of there. --- .config/vim/vimrc | 45 +++++++++++++++++++++++---------------------- 1 file changed, 23 insertions(+), 22 deletions(-) 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\+\%#\@