summaryrefslogtreecommitdiff
path: root/nvim/lua/plugins/dap.lua
diff options
context:
space:
mode:
author2025-05-02 16:05:47 +0300
committer2025-05-02 16:05:47 +0300
commit446d2716e7bb83e58fb516ec27e5c7750069e98c (patch)
tree3e2bdee9d79cf8495fde84a559d2b05bf7ca45b8 /nvim/lua/plugins/dap.lua
parentСделал кейбинды (diff)
downloaddotfiles-446d2716e7bb83e58fb516ec27e5c7750069e98c.tar.gz
dotfiles-446d2716e7bb83e58fb516ec27e5c7750069e98c.tar.bz2
dotfiles-446d2716e7bb83e58fb516ec27e5c7750069e98c.tar.xz
dotfiles-446d2716e7bb83e58fb516ec27e5c7750069e98c.zip
Перешел на lazy nvim, навел порядок в плагинах
Diffstat (limited to '')
-rw-r--r--nvim/lua/plugins/dap.lua158
1 files changed, 151 insertions, 7 deletions
diff --git a/nvim/lua/plugins/dap.lua b/nvim/lua/plugins/dap.lua
index 7c7f773..0d104d9 100644
--- a/nvim/lua/plugins/dap.lua
+++ b/nvim/lua/plugins/dap.lua
@@ -1,9 +1,153 @@
-require("dap-go").setup()
-require("dap").adapters.go = {
- type = "server",
- port = "${port}",
- executable = {
- command = "dlv",
- args = { "dap", "-l", "127.0.0.1:${port}" },
+return {
+ "leoluz/nvim-dap-go",
+ dependencies = { "mfussenegger/nvim-dap" },
+ opts = true,
+ config = function()
+ local dap, dapui = require("dap"), require("dapui")
+
+ dap.adapters.go = {
+ type = "server",
+ port = "${port}",
+ executable = {
+ command = "dlv",
+ args = { "dap", "-l", "127.0.0.1:${port}" },
+ },
+ }
+ 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
+ vim.api.nvim_set_hl(0, "DapBreakpoint", { ctermbg = 0, fg = "#993939", bg = "#31353f" })
+ vim.api.nvim_set_hl(0, "DapLogPoint", { ctermbg = 0, fg = "#61afef", bg = "#31353f" })
+ vim.api.nvim_set_hl(0, "DapStopped", { ctermbg = 0, fg = "#98c379", bg = "#31353f" })
+
+ vim.fn.sign_define(
+ "DapBreakpoint",
+ { text = "🐞", texthl = "DapBreakpoint", linehl = "DapBreakpoint", numhl = "DapBreakpoint" }
+ )
+ vim.fn.sign_define(
+ "DapBreakpointCondition",
+ { text = "ﳁ", texthl = "DapBreakpoint", linehl = "DapBreakpoint", numhl = "DapBreakpoint" }
+ )
+ vim.fn.sign_define(
+ "DapBreakpointRejected",
+ { text = "", texthl = "DapBreakpoint", linehl = "DapBreakpoint", numhl = "DapBreakpoint" }
+ )
+ vim.fn.sign_define(
+ "DapLogPoint",
+ { text = "", texthl = "DapLogPoint", linehl = "DapLogPoint", numhl = "DapLogPoint" }
+ )
+ vim.fn.sign_define(
+ "DapStopped",
+ { text = "", texthl = "DapStopped", linehl = "DapStopped", numhl = "DapStopped" }
+ )
+ end,
+ keys = {
+ {
+ "<F5>",
+ function()
+ require("dap").continue()
+ end,
+ silent = true,
+ },
+ {
+ "<F10>",
+ function()
+ require("dap").step_over()
+ end,
+ silent = true,
+ },
+ {
+ "<F11>",
+ function()
+ require("dap").step_into()
+ end,
+ silent = true,
+ },
+ {
+ "<F12>",
+ function()
+ require("dap").step_out()
+ end,
+ silent = true,
+ },
+ {
+ "<leader>dc",
+ function()
+ require("dap").continue()
+ end,
+ silent = true,
+ },
+ {
+ "<leader>so",
+ function()
+ require("dap").step_over()
+ end,
+ silent = true,
+ },
+ {
+ "<leader>si",
+ function()
+ require("dap").step_into()
+ end,
+ silent = true,
+ },
+ {
+ "<leader>st",
+ function()
+ require("dap").step_out()
+ end,
+ silent = true,
+ },
+ {
+ "<leader>b",
+ function()
+ require("dap").toggle_breakpoint()
+ end,
+ silent = true,
+ },
+ {
+ "<A-b>",
+ function()
+ require("dap").toggle_breakpoint()
+ end,
+ silent = true,
+ },
+ {
+ "<Leader>B",
+ function()
+ require("dap").set_breakpoint()
+ end,
+ silent = true,
+ },
+ {
+ "<Leader>lp",
+ function()
+ require("dap").set_breakpoint(nil, nil, vim.fn.input("Log point message: "))
+ end,
+ silent = true,
+ },
+ {
+ "<Leader>dr",
+ function()
+ require("dap").repl.open()
+ end,
+ silent = true,
+ },
+ {
+ "<Leader>dl",
+ function()
+ require("dap").run_last()
+ end,
+ silent = true,
+ },
},
}