commit d3baf265ef9fbd6faf9e5cc8b03f19fc63b13829
parent 2668248b25ea4f19bb2ae4902459b2f8af52faeb
Author: Alex Balgavy <a.balgavy@gmail.com>
Date: Thu, 24 Sep 2020 16:55:10 +0200
vim: fixed 'formatoptions' for gitignore ft
Former-commit-id: 552c4e8b80223a47a904dbf70af6849377155ca3
Diffstat:
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/vim/after/ftplugin/gitcommit.vim b/vim/after/ftplugin/gitcommit.vim
@@ -1,5 +1,5 @@
setlocal spell
setlocal spelllang=en
-setlocal formatoptions+=cat
+setlocal formatoptions=qnljat
let b:undo_ftplugin = (exists('b:undo_ftplugin') ? b:undo_ftplugin.'|' : '')
let b:undo_ftplugin .= 'setlocal spell< spelllang< formatoptions<'
diff --git a/vim/vimrc b/vim/vimrc
@@ -590,6 +590,13 @@ if has('breakindent')
set breakindentopt+=shift:3
endif
+" Default formatoptions:
+" - q: allow gq
+" - n: recognise numbered lists
+" - l: don't break long lines in insert mode
+" - j: remove comment leader when joining
+set formatoptions=qnlj
+
" Numbered lines
set number
set numberwidth=3
@@ -889,7 +896,6 @@ if has('autocmd')
autocmd!
autocmd InsertEnter * setlocal nocursorline
autocmd InsertLeave * setlocal cursorline
- autocmd FileType * setlocal formatoptions=qnlj
augroup END
augroup vimrc_commands
autocmd!