dotfiles/nvim/lua/helpers.lua

25 lines
595 B
Lua

local helpers = {}
function helpers.diagnostic_on_cursor_hold(bufnr)
vim.api.nvim_create_autocmd("CursorHold", {
buffer = bufnr,
callback = function()
local opts = {
focusable = false,
close_events = { "BufLeave", "CursorMoved", "InsertEnter", "FocusLost" },
border = 'rounded',
source = 'always',
prefix = ' ',
scope = 'cursor',
}
vim.diagnostic.open_float(nil, opts)
end
})
end
function helpers.nmap(keys, command, description)
vim.keymap.set('n', keys, command, { desc = description })
end
return helpers