dotfiles/nvim/lua/helpers.lua

25 lines
595 B
Lua
Raw Normal View History

2023-01-26 02:07:56 +01:00
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
2023-01-26 02:07:56 +01:00
return helpers