Bruno BELANYI
5918a0b9e6
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).
27 lines
726 B
Lua
27 lines
726 B
Lua
local signtoggle = vim.api.nvim_create_augroup("signtoggle", { clear = true })
|
|
|
|
-- Only show sign column for the currently focused buffer
|
|
vim.api.nvim_create_autocmd({ "BufEnter", "FocusGained", "WinEnter" }, {
|
|
pattern = "*",
|
|
group = signtoggle,
|
|
callback = function()
|
|
vim.opt.signcolumn = "yes"
|
|
end,
|
|
})
|
|
vim.api.nvim_create_autocmd({ "BufLeave", "FocusLost", "WinLeave" }, {
|
|
pattern = "*",
|
|
group = signtoggle,
|
|
callback = function()
|
|
vim.opt.signcolumn = "no"
|
|
end,
|
|
})
|
|
|
|
-- Never show the sign column in a terminal buffer
|
|
vim.api.nvim_create_autocmd({ "TermOpen" }, {
|
|
pattern = "*",
|
|
group = signtoggle,
|
|
callback = function()
|
|
vim.opt.signcolumn = "no"
|
|
end,
|
|
})
|