From f5dd2bd54b1cc972571e3c073f3ad10ecb743721 Mon Sep 17 00:00:00 2001 From: Fernando Schauenburg Date: Mon, 8 Nov 2021 12:26:58 +0100 Subject: [PATCH] vim: improve formatoptions --- nvim/init.vim | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/nvim/init.vim b/nvim/init.vim index 956c1bd..fcd06a2 100644 --- a/nvim/init.vim +++ b/nvim/init.vim @@ -19,10 +19,14 @@ set foldlevelstart=100 " start with all folds open set foldmethod=syntax " fold based on syntax by default set foldnestmax=10 " limit nested folds to 10 levels set formatlistpat="^\s*\(\d\+[\]:.)}\t ]\|[-*]\|\[[ x]\]\|([ x])\)\s*" -set formatoptions-=t " don't auto-wrap on 'textwidth' -set formatoptions+=c " do auto-wrap comments on 'textwidth' -set formatoptions+=j " remove comment leader when joining lines +set formatoptions-=t " don't auto-wrap on 'textwidth'... +set formatoptions+=c " ... but do it within comnment blocks. +set formatoptions+=r " insert comment leader when pressing Enter... +set formatoptions-=o " but not when openine a new line with o & O. +set formatoptions+=q " allow formatting of comments with gq +set formatoptions-=a " don't auto-format every time text is inserted set formatoptions+=n " recognize and indent lists automatically +set formatoptions+=j " remove comment leader when joining lines set hidden " hide abandoned buffers set ignorecase " ignore case when searching (see 'smartcase' below) let &inccommand='split' " show command partial results