From 41656d28d6e9d601a1a923b1dd517175b36b235b Mon Sep 17 00:00:00 2001 From: Julian Prein Date: Fri, 18 Mar 2022 17:33:56 +0100 Subject: [PATCH] vim:autocmd: Reset textwidth value in colorcolumn Instead of overwriting the entire colorcolumn value, reset only the textwidth value, by subtracting it first and then readding it. --- .config/vim/vimrc.d/80-autocommands.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.config/vim/vimrc.d/80-autocommands.vim b/.config/vim/vimrc.d/80-autocommands.vim index d1fc95c..382cfaf 100644 --- a/.config/vim/vimrc.d/80-autocommands.vim +++ b/.config/vim/vimrc.d/80-autocommands.vim @@ -58,7 +58,7 @@ endif autocmd SourcePost termdebug.vim tnoremap " Adjust the colorcolumn together with &textwidth -autocmd OptionSet textwidth let &colorcolumn=&textwidth +autocmd OptionSet textwidth exec 'set cc=' . v:option_old . ' | set cc+=' . &tw " " Highlight word under cursor augroup highlight_current_word