M = {} M.get_config = function() return { 'igorlfs/nvim-dap-view', opts = { winbar = { controls = { enabled = true }, sections = { 'watches', 'scopes', 'console', 'breakpoints', 'threads', 'repl' }, }, windows = { terminal = { -- `go` is known to not use the terminal. hide = { 'go' }, }, }, }, keys = { { 'dvv', 'DapViewToggle' }, { 'dvb', 'DapViewShow breakpoints' }, { 'dvs', 'DapViewShow scopes' }, { 'dvw', 'DapViewShow watches' }, { 'dvW', 'DapViewWatch' }, { 'dvr', 'DapViewShow repl' }, { 'dvc', 'DapViewShow console' }, }, config = function(_, opts) require('dap-view').setup(opts) vim.api.nvim_create_autocmd('QuitPre', { group = vim.api.nvim_create_augroup('dap-view-extra', {}), pattern = '*', callback = function(_) local wins = vim.api.nvim_list_wins() local splits = 0 for _, w in ipairs(wins) do local buf = vim.api.nvim_win_get_buf(w) local name = vim.api.nvim_buf_get_name(buf) if not (name:match 'dap%-view' or name:match 'dap%-repl' or name == '') then splits = splits + 1 end end if splits == 1 then require('dap-view').close() end end, }) end, } end return M