home: vim: signtoggle: use lua callbacks

Use `vim.opt` because this is a local option (i.e: similar to `set` it
defaults to setting it locally, `vim.opt_local` is not necessary).
This commit is contained in:
Bruno BELANYI 2024-07-15 20:40:59 +01:00
parent a7c542784c
commit 5918a0b9e6

View file

@ -4,17 +4,23 @@ local signtoggle = vim.api.nvim_create_augroup("signtoggle", { clear = true })
vim.api.nvim_create_autocmd({ "BufEnter", "FocusGained", "WinEnter" }, { vim.api.nvim_create_autocmd({ "BufEnter", "FocusGained", "WinEnter" }, {
pattern = "*", pattern = "*",
group = signtoggle, group = signtoggle,
command = "setlocal signcolumn=yes", callback = function()
vim.opt.signcolumn = "yes"
end,
}) })
vim.api.nvim_create_autocmd({ "BufLeave", "FocusLost", "WinLeave" }, { vim.api.nvim_create_autocmd({ "BufLeave", "FocusLost", "WinLeave" }, {
pattern = "*", pattern = "*",
group = signtoggle, group = signtoggle,
command = "setlocal signcolumn=no", callback = function()
vim.opt.signcolumn = "no"
end,
}) })
-- Never show the sign column in a terminal buffer -- Never show the sign column in a terminal buffer
vim.api.nvim_create_autocmd({ "TermOpen" }, { vim.api.nvim_create_autocmd({ "TermOpen" }, {
pattern = "*", pattern = "*",
group = signtoggle, group = signtoggle,
command = "setlocal signcolumn=no", callback = function()
vim.opt.signcolumn = "no"
end,
}) })