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:
parent
dba8836381
commit
39c2e5db8c
|
@ -1,8 +1,22 @@
|
|||
augroup signtoggle
|
||||
autocmd!
|
||||
" Only show the sign column for the current focused buffer
|
||||
autocmd BufEnter,FocusGained,WinEnter * set signcolumn=yes
|
||||
autocmd BufLeave,FocusLost,WinLeave * set signcolumn=no
|
||||
" Disable the sign column in terminal
|
||||
autocmd TermOpen * setlocal signcolumn=no
|
||||
augroup END
|
||||
lua << EOF
|
||||
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,
|
||||
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
|
||||
|
|
Loading…
Reference in a new issue