configure dapui, add bindings

This commit is contained in:
fiplox 2023-01-17 17:49:52 +01:00
parent fbc08b15bd
commit 9b0dcc66ba
1 changed files with 76 additions and 43 deletions

View File

@ -3,46 +3,6 @@ local M = {
dependencies = {
{
'rcarriga/nvim-dap-ui',
config = function()
require('dapui').setup {
mapping = {
edit = 'l',
},
layouts = {
{
elements = {
-- Elements can be strings or table with id and size keys.
{ id = 'scopes', size = 0.25 },
'breakpoints',
-- "stacks",
-- "watches",
},
size = 50,
position = 'right',
},
{
elements = {
'repl',
'console',
},
size = 0.25, -- 25% of total lines
position = 'bottom',
},
},
floating = {
max_height = nil, -- These can be integers or a float between 0 and 1.
max_width = nil, -- Floats will be treated as percentage of your screen.
border = 'single', -- Border style. Can be "single", "double" or "rounded"
mappings = {
close = { 'q', '<Esc>' },
},
},
windows = { indent = 1 },
render = {
max_type_length = nil, -- Can be integer or nil.
},
}
end,
},
},
}
@ -56,6 +16,10 @@ function M.init()
require('dap').continue()
end, { desc = 'Continue' })
vim.keymap.set('n', '<leader>dC', function()
require('dap').close()
end, { desc = 'Close' })
vim.keymap.set('n', '<leader>do', function()
require('dap').step_over()
end, { desc = 'Step Over' })
@ -75,15 +39,84 @@ function M.init()
vim.keymap.set('n', '<leader>du', function()
require('dapui').toggle {}
end, { desc = 'Dap UI' })
vim.keymap.set('n', '<leader>dfb', function()
require('dapui').float_element('breakpoints', { enter = true })
end, { desc = 'Dap UI' })
vim.keymap.set('n', '<leader>dfS', function()
require('dapui').float_element('stacks', { enter = true })
end, { desc = 'Dap UI' })
vim.keymap.set('n', '<leader>dfw', function()
require('dapui').float_element('watches', { enter = true })
end, { desc = 'Dap UI' })
vim.keymap.set('n', '<leader>dfs', function()
require('dapui').float_element('scopes', { enter = true })
end, { desc = 'Dap UI' })
end
function M.config()
local dap = require 'dap'
local dapui = require 'dapui'
dap.listeners.after.event_initialized['dapui_config'] = function()
dapui.open {}
end
dapui.setup {
mapping = {
edit = 'l',
},
element_mappings = {
scopes = {
edit = 'l',
},
breakpoints = {
edit = 'l',
},
stacks = {
edit = 'l',
},
watches = {
edit = 'l',
},
},
layouts = {
{
elements = {
-- Elements can be strings or table with id and size keys.
{ id = 'scopes', size = 0.25 },
'breakpoints',
'stacks',
-- "watches",
},
size = 50,
position = 'right',
},
{
elements = {
'repl',
'console',
},
size = 0.25, -- 25% of total lines
position = 'bottom',
},
},
floating = {
max_height = nil, -- These can be integers or a float between 0 and 1.
max_width = nil, -- Floats will be treated as percentage of your screen.
border = 'rounded', -- Border style. Can be "single", "double" or "rounded"
mappings = {
close = { 'q', '<Esc>' },
edit = 'l',
},
},
windows = { indent = 1 },
render = {
max_type_length = nil, -- Can be integer or nil.
},
}
-- dap.listeners.after.event_initialized['dapui_config'] = function()
-- dapui.open {}
-- end
dap.listeners.before.event_terminated['dapui_config'] = function()
dapui.close {}
end