home-manager/neovim/dap.lua

36 lines
1.2 KiB
Lua
Raw Permalink Normal View History

2024-07-10 06:10:56 +00:00
local dap = require("dap")
local dapui = require("dapui")
dapui.setup()
vim.fn.sign_define("DapBreakpoint", { text = "🔴", texthl = "", linehl = "", numhl = "" })
-- debugging keymaps
vim.keymap.set("n", "<F5>", dap.continue, { noremap = true, silent = true })
vim.keymap.set("n", "<F9>", dap.toggle_breakpoint, { noremap = true, silent = true })
vim.keymap.set("n", "<F10>", dap.step_over, { noremap = true, silent = true })
vim.keymap.set("n", "<F11>", dap.step_into, { noremap = true, silent = true })
vim.keymap.set("n", "<S-F11>", dap.step_out, { noremap = true, silent = true })
vim.keymap.set("n", "<F23>", dap.step_out, { noremap = true, silent = true }) -- <Shift-F11> in kitty
vim.keymap.set("n", "<M-k>", dapui.eval, { noremap = true, silent = true })
-- trigger auto-completion in repl
vim.cmd([[
augroup TriggerDapReplAutoCompletion
autocmd!
autocmd FileType dap-repl lua require("dap.ext.autocompl").attach()
augroup END
]])
dap.listeners.after.event_initialized["dapui_config"] = function()
dapui.open()
end
dap.listeners.before.event_terminated["dapui_config"] = function()
dapui.close()
end
dap.listeners.before.event_exited["dapui_config"] = function()
dapui.close()
end