nvim: fix color column configuration

This commit is contained in:
Primrose 2025-07-09 09:54:07 +02:00
parent 22e1b7bf92
commit 841d371dd0
Signed by: primrose
GPG key ID: 4E887A4CA9714ADA
3 changed files with 10 additions and 2 deletions

View file

@ -1,4 +1,3 @@
vim.bo.shiftwidth = 2
vim.bo.tabstop = 2
vim.bo.textwidth = 100
vim.wo.colorcolumn = "100"

View file

@ -1,4 +1,3 @@
vim.bo.shiftwidth = 2
vim.bo.tabstop = 2
vim.bo.textwidth = 100
vim.wo.colorcolumn = "100"

View file

@ -23,10 +23,20 @@ vim.api.nvim_create_autocmd("OptionSet", {
end,
})
local auto_colorcolumn = vim.api.nvim_create_augroup("auto_colorcolumn", {})
vim.api.nvim_create_autocmd("OptionSet", {
group = auto_colorcolumn,
pattern = "textwidth",
callback = function() vim.wo.colorcolumn = tostring(vim.bo.textwidth) end,
})
vim.api.nvim_create_autocmd("BufEnter", {
group = auto_colorcolumn,
callback = function()
if vim.bo.textwidth then
vim.wo.colorcolumn = tostring(vim.bo.textwidth)
end
end,
})
vim.api.nvim_create_autocmd("LspProgress", {
once = true,