mirror of
https://github.com/Crocmagnon/dotfiles.git
synced 2024-11-21 22:18:07 +01:00
improve nvim debugging experience
This commit is contained in:
parent
3bd295933f
commit
500fbc0cef
3 changed files with 63 additions and 6 deletions
14
dot_config/nvim/lua/custom/configs/nvim-dap-ui.lua
Normal file
14
dot_config/nvim/lua/custom/configs/nvim-dap-ui.lua
Normal file
|
@ -0,0 +1,14 @@
|
|||
local dap, dapui = require("dap"), require("dapui")
|
||||
dap.listeners.before.attach.dapui_config = function()
|
||||
dapui.open()
|
||||
end
|
||||
dap.listeners.before.launch.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
|
||||
|
|
@ -7,13 +7,34 @@ M.dap = {
|
|||
"<cmd> DapToggleBreakpoint <CR>",
|
||||
"Add breakpoint at line"
|
||||
},
|
||||
["<leader>dc"] = {
|
||||
"<cmd> DapContinue <CR>",
|
||||
"Debug - continue"
|
||||
},
|
||||
["<leader>dsi"] = {
|
||||
"<cmd> DapStepInto <CR>",
|
||||
"Debug - step into"
|
||||
},
|
||||
["<leader>dn"] = {
|
||||
"<cmd> DapStepOver <CR>",
|
||||
"Debug - step over (next)"
|
||||
},
|
||||
["<leader>dso"] = {
|
||||
"<cmd> DapStepOut <CR>",
|
||||
"Debug - step out"
|
||||
},
|
||||
["<leader>dt"] = {
|
||||
"<cmd> DapTerminate <CR>",
|
||||
"Debug - terminate"
|
||||
},
|
||||
["<leader>dus"] = {
|
||||
function ()
|
||||
local widgets = require('dap.ui.widgets');
|
||||
local sidebar = widgets.sidebar(widgets.scopes);
|
||||
sidebar.open();
|
||||
require("dapui").toggle();
|
||||
-- local widgets = require('dap.ui.widgets');
|
||||
-- local sidebar = widgets.sidebar(widgets.scopes);
|
||||
-- sidebar.open();
|
||||
end,
|
||||
"Open debugging sidebar"
|
||||
"Toggle debugging interface"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -29,13 +50,25 @@ M.dap_go = {
|
|||
},
|
||||
["<leader>dgl"] = {
|
||||
function()
|
||||
require("dap-go").debug_last()
|
||||
require("dap-go").debug_last_test()
|
||||
end,
|
||||
"Debug last go test"
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
M.dap_ui = {
|
||||
plugin = true,
|
||||
n = {
|
||||
["È"] = { -- alt+k
|
||||
function()
|
||||
require("dapui").eval()
|
||||
end,
|
||||
"Debug - eval expression"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
M.terminal = {
|
||||
t = {
|
||||
["<Esc>"] = {"<C-\\><C-n>"}
|
||||
|
|
|
@ -22,6 +22,16 @@ local plugins = {
|
|||
require("core.utils").load_mappings("dap_go")
|
||||
end,
|
||||
},
|
||||
{
|
||||
"rcarriga/nvim-dap-ui", -- UI for the DAP debugger
|
||||
ft = "go",
|
||||
dependencies = "mfussenegger/nvim-dap",
|
||||
config = function()
|
||||
require("dapui").setup()
|
||||
require "custom.configs.nvim-dap-ui"
|
||||
require("core.utils").load_mappings("dap_ui")
|
||||
end,
|
||||
},
|
||||
{
|
||||
"neovim/nvim-lspconfig", -- load custom lsp config
|
||||
config = function()
|
||||
|
@ -45,6 +55,6 @@ local plugins = {
|
|||
build = function()
|
||||
vim.cmd [[silent! GoInstallDeps]]
|
||||
end,
|
||||
}
|
||||
},
|
||||
}
|
||||
return plugins
|
||||
|
|
Loading…
Reference in a new issue