54 lines
1.5 KiB
Lua
54 lines
1.5 KiB
Lua
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 = {
|
|
{ '<leader>dvv', '<cmd>DapViewToggle<cr>' },
|
|
{ '<leader>dvb', '<cmd>DapViewShow breakpoints<cr>' },
|
|
{ '<leader>dvs', '<cmd>DapViewShow scopes<cr>' },
|
|
{ '<leader>dvw', '<cmd>DapViewShow watches<cr>' },
|
|
{ '<leader>dvW', '<cmd>DapViewWatch<cr>' },
|
|
{ '<leader>dvr', '<cmd>DapViewShow repl<cr>' },
|
|
{ '<leader>dvc', '<cmd>DapViewShow console<cr>' },
|
|
},
|
|
|
|
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
|