diff --git a/.config/nvim/plugin/autocommands.lua b/.config/nvim/plugin/autocommands.lua index fc114051..648a0c1d 100644 --- a/.config/nvim/plugin/autocommands.lua +++ b/.config/nvim/plugin/autocommands.lua @@ -16,24 +16,23 @@ vim.api.nvim_create_autocmd("OptionSet", { for _ = c:len(), vim.o.shiftwidth + 1 do c = c .. " " end - return vim.opt.lcs:append("leadmultispace:" .. c) - else - return nil + vim.opt.listchars:append("leadmultispace:" .. c) end end, }) local auto_colorcolumn = vim.api.nvim_create_augroup("auto_colorcolumn", {}) +local set_colorcolumn_from_textwidth = function() vim.wo.colorcolumn = tostring(vim.bo.textwidth) end vim.api.nvim_create_autocmd("OptionSet", { group = auto_colorcolumn, pattern = "textwidth", - callback = function() vim.wo.colorcolumn = tostring(vim.bo.textwidth) end, + callback = set_colorcolumn_from_textwidth, }) vim.api.nvim_create_autocmd("BufEnter", { group = auto_colorcolumn, callback = function() if vim.bo.textwidth then - vim.wo.colorcolumn = tostring(vim.bo.textwidth) + set_colorcolumn_from_textwidth() end end, })