diff --git a/.config/nvim/lua/coding.lua b/.config/nvim/lua/coding.lua index e5fa3a3..b5ff9fb 100644 --- a/.config/nvim/lua/coding.lua +++ b/.config/nvim/lua/coding.lua @@ -28,7 +28,7 @@ vim.api.nvim_create_autocmd( pattern = { 'gitcommit', 'gitrebase' }, callback = function() -- FIXME: why does the autocmd in settings.lua not set it? - vim.wo.colorcolumn = tostring(vim.o.textwidth) + vim.opt_local.colorcolumn = tostring(vim.o.textwidth) vim.cmd([[startinsert | 1]]) end }) diff --git a/.config/nvim/lua/settings.lua b/.config/nvim/lua/settings.lua index 57fca54..2bd261e 100644 --- a/.config/nvim/lua/settings.lua +++ b/.config/nvim/lua/settings.lua @@ -32,15 +32,15 @@ packer.use 'https://github.com/editorconfig/editorconfig-vim' -- set colorcolumn to textwidth after buffer is displayed or option is changed vim.api.nvim_create_augroup('config_settings', { clear = true }) vim.api.nvim_create_autocmd( - { 'BufWinEnter', 'OptionSet' }, + { 'OptionSet' }, { group = 'config_settings', pattern = { 'textwidth' }, callback = function() if vim.o.textwidth > 0 then - vim.wo.colorcolumn = tostring(vim.o.textwidth) + vim.opt_local.colorcolumn = tostring(vim.o.textwidth) else - vim.wo.colorcolumn = '' + vim.opt_local.colorcolumn = '' end end }