feat(nvim): only show cursorline on active buffer

This commit is contained in:
Oliver Davies 2022-07-12 09:29:04 +01:00
parent 6b70074004
commit 6dc90947a5

View file

@ -18,6 +18,22 @@ local function set_autocmd()
"VimResized *", "VimResized *",
{ command = ":wincmd =" } { command = ":wincmd =" }
) )
-- Cursorline highlighting control.
-- Only have it on in the current buffer.
local group = vim.api.nvim_create_augroup("CursorLineControl", { clear = true })
local set_cursorline = function(event, value, pattern)
vim.api.nvim_create_autocmd(event, {
group = group,
pattern = pattern,
callback = function()
vim.opt_local.cursorline = value
end,
})
end
set_cursorline("WinLeave", false)
set_cursorline("WinEnter", true)
set_cursorline("FileType", false, "TelescopePrompt")
end end
local function set_filetypes() local function set_filetypes()