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
|
|
|
|
|
2023-03-25 13:42:53 +01:00
|
|
|
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
|