ui: opinionated nvim-dap-ui layout with auto open/close

This commit is contained in:
swaits committed 2026-04-11 16:38:17 -06:00
1 parent 6931334904
commit 5ef0031ffe
2 files changed
+45

No files matched your search

+3
View File
@@ -1,5 +1,6 @@
local config = require("tiny-debugger.config")
local help = require("tiny-debugger.help")
local ui = require("tiny-debugger.ui")
local M = {}
@@ -105,6 +106,7 @@ function M.enter()
local buf = vim.api.nvim_get_current_buf()
set_keymaps(buf)
set_cursor_highlight()
ui.open()
if config.opts.help_on_enter then
help.open()
@@ -119,6 +121,7 @@ function M.exit()
clear_keymaps(buf)
restore_cursor_highlight()
help.close()
ui.close()
end
function M.toggle()
+42
View File
@@ -0,0 +1,42 @@
local config = require("tiny-debugger.config")
local M = {}
local initialized = false
local function ensure_setup()
if initialized then return end
initialized = true
local dapui = require("dapui")
dapui.setup(config.opts.dapui)
-- auto-exit debug mode when session ends
local dap = require("dap")
local mode = require("tiny-debugger.mode")
dap.listeners.after.event_terminated["tiny-debugger"] = function()
if mode.is_active() then
mode.exit()
end
end
dap.listeners.after.event_exited["tiny-debugger"] = function()
if mode.is_active() then
mode.exit()
end
end
end
function M.open()
ensure_setup()
require("dapui").open()
end
function M.close()
if initialized then
require("dapui").close()
end
end
return M