summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lua/plugins/dap-ui.lua59
1 files changed, 59 insertions, 0 deletions
diff --git a/lua/plugins/dap-ui.lua b/lua/plugins/dap-ui.lua
new file mode 100644
index 0000000..6df72c5
--- /dev/null
+++ b/lua/plugins/dap-ui.lua
@@ -0,0 +1,59 @@
+return {
+ "rcarriga/nvim-dap-ui",
+ dependencies = {
+ "nvim-neotest/nvim-nio",
+ },
+ keys = {
+ {
+ "<leader>du",
+ function()
+ require("dapui").toggle({ layout = 1 })
+ end,
+ desc = "Dap UI",
+ },
+ },
+ opts = {
+ layouts = {
+ -- Run layout
+ {
+ elements = {
+ { id = "repl", size = 0.20 },
+ { id = "console", size = 0.80 },
+ },
+ size = 30,
+ position = "bottom",
+ },
+ -- Debug layout
+ {
+ elements = {
+ { id = "scopes", size = 0.20 },
+ { id = "stacks", size = 0.20 },
+ { id = "console", size = 0.60 },
+ },
+ size = 30,
+ position = "bottom",
+ },
+ },
+ },
+ config = function(_, opts)
+ require("dapui").setup(opts)
+
+ local listener = require("dap").listeners
+ listener.after.event_initialized["dapui_config"] = function()
+ require("dapui").close()
+ require("dapui").toggle({ layout = 1 })
+ end
+ listener.after.event_continued["dapui_config"] = function()
+ require("dapui").close()
+ require("dapui").toggle({ layout = 1 })
+ end
+ listener.after.event_breakpoint["dapui_config"] = function()
+ require("dapui").close()
+ require("dapui").toggle({ layout = 2 })
+ end
+ listener.after.event_terminated["dapui_config"] = function()
+ require("dapui").close()
+ require("dapui").toggle({ layout = 1 })
+ end
+ end,
+}