nvim/lua/custom/mappings.lua

52 lines
1.2 KiB
Lua

local M = {}
M.dap = {
plugin = true,
n = {
["<leader>db"] = { "<cmd> DapToggleBreakpoint <CR>" },
["<leader>dus"] = {
function()
local widgets = require "dap.ui.widgets"
local sidebar = widgets.sidebar(widgets.scopes)
sidebar.open()
end,
"Open debugging sidebar",
},
},
}
M.crates = {
plugin = true,
n = {
["<leader>rcu"] = {
function()
require("crates").upgrade_all_crates()
end,
"update crates",
},
},
}
-- Function to show diagnostics on hover
vim.api.nvim_create_autocmd("CursorHold", {
callback = function()
local opts = {
focusable = false,
close_events = { "BufLeave", "CursorMoved", "InsertEnter", "FocusLost" },
border = "rounded",
source = "always", -- show source in diagnostics popup window
prefix = " ",
scope = "cursor",
}
vim.diagnostic.open_float(nil, opts)
end,
})
-- Optional: keybinding to manually show diagnostics on hover
vim.api.nvim_set_keymap("n", "<leader>e", "<cmd>lua vim.diagnostic.open_float()<CR>", { noremap = true, silent = true })
require "custom.language_specific_commands.matlab"
require "custom.language_specific_commands.rust"
return M