Skip to content

Commit b2fdea8

Browse files
committed
feat: allow disabling forced buffers
See #212
1 parent b3b9770 commit b2fdea8

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

doc/nvim-dap-ui.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ Default values:
7575
close = { "q", "<Esc>" }
7676
}
7777
},
78+
force_buffers = true,
7879
icons = {
7980
collapsed = "",
8081
current_frame = "",
@@ -256,6 +257,8 @@ Fields~
256257
{element_mappings} `(table<string, table<dapui.Action, string|string[]>>)` Per-element overrides of global mappings
257258
{expand_lines} `(boolean)` Expand current line to hover window if larger
258259
than window size
260+
{force_buffers} `(boolean)` Prevents other buffers being loaded into
261+
nvim-dap-ui windows
259262
{layouts} `(dapui.Config.layout[])` Layouts to display elements within.
260263
Layouts are opened in the order defined
261264
{floating} `(dapui.Config.floating)` Floating window specific options

lua/dapui/config/init.lua

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ local dapui = {}
99
---@field element_mappings table<string, table<dapui.Action, string|string[]>> Per-element overrides of global mappings
1010
---@field expand_lines boolean Expand current line to hover window if larger
1111
--- than window size
12+
---@field force_buffers boolean Prevents other buffers being loaded into
13+
--- nvim-dap-ui windows
1214
---@field layouts dapui.Config.layout[] Layouts to display elements within.
1315
--- Layouts are opened in the order defined
1416
---@field floating dapui.Config.floating Floating window specific options
@@ -83,6 +85,7 @@ local default_config = {
8385
},
8486
element_mappings = {},
8587
expand_lines = vim.fn.has("nvim-0.7") == 1,
88+
force_buffers = true,
8689
layouts = {
8790
{
8891
-- You can change the order of elements in the sidebar

lua/dapui/windows/init.lua

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,12 +75,14 @@ function M.setup(element_buffers)
7575
end
7676
M.layouts[i] = M.area_layout(layout.size, layout.position, layout.elements, buffers)
7777
end
78-
vim.cmd([[
78+
if config.force_buffers then
79+
vim.cmd([[
7980
augroup DapuiWindowsSetup
8081
au!
8182
au BufWinEnter,BufWinLeave * lua require('dapui.windows')._force_buffers()
8283
augroup END
8384
]])
85+
end
8486
end
8587

8688
function M._force_buffers()

0 commit comments

Comments
 (0)