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.
This commit is contained in:
2022-03-18 17:33:56 +01:00
parent 11530608c9
commit 41656d28d6

View File

@@ -58,7 +58,7 @@ endif
autocmd SourcePost termdebug.vim tnoremap <Esc> <C-\><C-n>
" 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