home: vim: signtoggle: use lua autocommands

A nice next step would be to use actual lua callbacks instead of the
VimL command.
This commit is contained in:
Bruno BELANYI 2023-05-06 18:17:16 +01:00
parent dba8836381
commit 39c2e5db8c
1 changed files with 22 additions and 8 deletions

View File

@ -1,8 +1,22 @@
augroup signtoggle lua << EOF
autocmd! local signtoggle = vim.api.nvim_create_augroup("signtoggle", { clear = true })
" Only show the sign column for the current focused buffer
autocmd BufEnter,FocusGained,WinEnter * set signcolumn=yes -- Only show sign column for the currently focused buffer
autocmd BufLeave,FocusLost,WinLeave * set signcolumn=no vim.api.nvim_create_autocmd({ "BufEnter", "FocusGained", "WinEnter" }, {
" Disable the sign column in terminal pattern = "*",
autocmd TermOpen * setlocal signcolumn=no group = signtoggle,
augroup END command = "setlocal signcolumn=yes",
})
vim.api.nvim_create_autocmd({ "BufLeave", "FocusLost", "WinLeave" }, {
pattern = "*",
group = signtoggle,
command = "setlocal signcolumn=yes",
})
-- Never show the sign column in a terminal buffer
vim.api.nvim_create_autocmd({ "TermOpen" }, {
pattern = "*",
group = signtoggle,
command = "setlocal signcolumn=no",
})
EOF