diff options
author | David Luevano Alvarado <david@luevano.xyz> | 2023-12-26 19:37:33 -0600 |
---|---|---|
committer | David Luevano Alvarado <david@luevano.xyz> | 2023-12-26 19:37:33 -0600 |
commit | 2b3fbe7925a24ac4569ea4bd2d5c4069feb6f81f (patch) | |
tree | 7ef72413d619a950fa06bd0ec17811702f93d1b3 /lua/plugins | |
parent | 24f547435d321a9c93a235f653b79f1854049767 (diff) |
feat: add debug capabilities, remove rest of kickstart
Diffstat (limited to 'lua/plugins')
-rw-r--r-- | lua/plugins/debug.lua | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/lua/plugins/debug.lua b/lua/plugins/debug.lua new file mode 100644 index 0000000..b4b7783 --- /dev/null +++ b/lua/plugins/debug.lua @@ -0,0 +1,57 @@ +return { + 'mfussenegger/nvim-dap', + dependencies = { + 'rcarriga/nvim-dap-ui', + 'williamboman/mason.nvim', + 'jay-babu/mason-nvim-dap.nvim', + 'leoluz/nvim-dap-go', + }, + config = function() + local dap = require('dap') + local dapui = require('dapui') + + require('mason-nvim-dap').setup { + automatic_setup = true, + handlers = {}, + ensure_installed = { + 'delve', + }, + } + + local nmap = function(keys, func, desc) + if desc then + desc = 'DAP: ' .. desc + end + vim.keymap.set('n', keys, func, { desc = desc }) + end + nmap('<F5>', dap.continue) + nmap('<F1>', dap.step_into) + nmap('<F2>', dap.step_over) + nmap('<F3>', dap.step_out) + nmap("<leader>du", dapui.toggle, "Toggle [u]i") + nmap('<leader>db', dap.toggle_breakpoint, "Toggle [b]reakpoint") + + dapui.setup({ + icons = { expanded = '▾', collapsed = '▸', current_frame = '*' }, + controls = { + icons = { + pause = '⏸', + play = '▶', + step_into = '⏎', + step_over = '⏭', + step_out = '⏮', + step_back = 'b', + run_last = '▶▶', + terminate = '⏹', + disconnect = "⏏", + }, + }, + }) + + dap.listeners.after.event_initialized['dapui_config'] = dapui.open + dap.listeners.before.event_terminated['dapui_config'] = dapui.close + dap.listeners.before.event_exited['dapui_config'] = dapui.close + + require('dap-go').setup({}) + end, +} |