From 164af2e500a47e597d219e712b97353e79cbfc2f Mon Sep 17 00:00:00 2001 From: druckdev <63563978+druckdev@users.noreply.github.com> Date: Sat, 10 Oct 2020 00:30:09 +0200 Subject: [PATCH] vim: Automatic formatting --- .config/vim/ftplugin/gitcommit.vim | 1 + .config/vim/vimrc | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/.config/vim/ftplugin/gitcommit.vim b/.config/vim/ftplugin/gitcommit.vim index 45c2c76..9063a2f 100644 --- a/.config/vim/ftplugin/gitcommit.vim +++ b/.config/vim/ftplugin/gitcommit.vim @@ -1,4 +1,5 @@ " Shorter lines. Subject should be max 50 and body max 72 setlocal colorcolumn=50,72 +setlocal textwidth=72 " Spell checking always enabled setlocal spell spelllang=en diff --git a/.config/vim/vimrc b/.config/vim/vimrc index 07db713..bfecd2f 100644 --- a/.config/vim/vimrc +++ b/.config/vim/vimrc @@ -24,8 +24,12 @@ set tabstop=4 set shiftwidth=0 " Highlight current line set cursorline -" Automatically add leading comment (when pressing o/O or enter in Insert) -set formatoptions+=cro +" Auto-wrap text and comments; automatically add comment leader when creating +" new lines and delete it when joining; do not break already too long lines; +" allow formatting with gq. +set formatoptions=tcroqlj +" Keep lines under 80 characters. +set textwidth=80 " see :help persistent-undo set undofile " Update every 300ms for better experience with plugins like gitgutter and coc