vim: Reorder config and create autocommand section
Move everything that is not strictly part of "Aesthetics" out of there.
This commit is contained in:
@@ -44,6 +44,8 @@ else
|
|||||||
endif
|
endif
|
||||||
" Copy structure of the existing lines indent when autoindenting a new line
|
" Copy structure of the existing lines indent when autoindenting a new line
|
||||||
set copyindent
|
set copyindent
|
||||||
|
" Show ruler at 80 and 100 columns
|
||||||
|
set colorcolumn=80,100
|
||||||
|
|
||||||
" Keybindings ##################################################################
|
" Keybindings ##################################################################
|
||||||
" Set leader key
|
" Set leader key
|
||||||
@@ -105,10 +107,31 @@ if (has('nvim'))
|
|||||||
highlight NonText guibg=NONE
|
highlight NonText guibg=NONE
|
||||||
endif
|
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
|
" zshOption is a huge regex that leads to massive lags when scrolling
|
||||||
" Be sure to disable it after activating syntax highlighting
|
" Be sure to disable it after activating syntax highlighting
|
||||||
autocmd filetype zsh syntax clear zshOption
|
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\+\%#\@<!$/
|
||||||
|
" Reset when leaving insert mode
|
||||||
|
autocmd InsertLeave * match ExtraWhitespace /\s\+$/
|
||||||
|
" Clear all matches
|
||||||
|
autocmd BufWinLeave * call clearmatches()
|
||||||
|
|
||||||
" change cursor shape depending on mode
|
" change cursor shape depending on mode
|
||||||
if (has('nvim'))
|
if (has('nvim'))
|
||||||
" Beam when exiting
|
" Beam when exiting
|
||||||
@@ -142,25 +165,3 @@ else
|
|||||||
autocmd VimLeave * silent !echo -ne "\e[5 q"
|
autocmd VimLeave * silent !echo -ne "\e[5 q"
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
" 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\+\%#\@<!$/
|
|
||||||
" Reset when leaving insert mode
|
|
||||||
autocmd InsertLeave * match ExtraWhitespace /\s\+$/
|
|
||||||
" Clear all matches
|
|
||||||
autocmd BufWinLeave * call clearmatches()
|
|
||||||
|
|
||||||
" Show ruler at 80 and 100 columns
|
|
||||||
set colorcolumn=80,100
|
|
||||||
" 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
|
|
||||||
|
|||||||
Reference in New Issue
Block a user