Skip to content

Commit

Permalink
feat: custom window selection
Browse files Browse the repository at this point in the history
See #212
  • Loading branch information
rcarriga committed Feb 23, 2023
1 parent f6137d7 commit bdb94e3
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions doc/nvim-dap-ui.txt
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,8 @@ Layouts are opened in the order defined
{controls} `(dapui.Config.controls)` Controls configuration
{render} `(dapui.Config.render)` Rendering options which can be updated
after initial setup
{select_window?} `(fun(): integer)` A function which returns a window to be
used for opening buffers such as a stack frame location.

*dapui.Config.icons*
Fields~
Expand Down
2 changes: 2 additions & 0 deletions lua/dapui/config/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ local dapui = {}
---@field controls dapui.Config.controls Controls configuration
---@field render dapui.Config.render Rendering options which can be updated
--- after initial setup
---@field select_window? fun(): integer A function which returns a window to be
--- used for opening buffers such as a stack frame location.

---@class dapui.Config.icons
---@field expanded string
Expand Down
3 changes: 3 additions & 0 deletions lua/dapui/util.lua
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@ local function set_opts(win, opts)
end

function M.select_win()
if config.select_window then
return config.select_window()
end
local windows = vim.tbl_filter(function(win)
if api.nvim_win_get_config(win).relative ~= "" then
return false
Expand Down

0 comments on commit bdb94e3

Please sign in to comment.