diff --git a/_config/nvim/plugin/dap.lua b/_config/nvim/plugin/dap.lua new file mode 100644 index 0000000..3dffc65 --- /dev/null +++ b/_config/nvim/plugin/dap.lua @@ -0,0 +1,49 @@ +local dap = require("dap") +local dapui = require("dapui") + +dapui.setup({}) + +dap.adapters.codelldb = { + type = 'server', + port = "${port}", + executable = { + -- Change this to your path! + command = '/usr/bin/codelldb', + args = {"--port", "${port}"}, + } +} + +dap.configurations.rust= { + { + name = "Launch file", + type = "codelldb", + request = "launch", + program = function() + return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file') + end, + cwd = '${workspaceFolder}', + stopOnEntry = false, + }, +} + +vim.keymap.set('n', 'dc', function() dap.continue() end) +vim.keymap.set('n', '', function() dap.step_over() end) +vim.keymap.set('n', '', function() dap.step_into() end) +vim.keymap.set('n', '', function() dap.step_out() end) +vim.keymap.set('n', 'db', function() dap.toggle_breakpoint() end) +vim.keymap.set('n', 'dl', function() dap.run_last() end) +vim.keymap.set('n', 'du', function() dapui.toggle() end) +vim.keymap.set('n', 'df', function() dapui.float_element('scopes', { enter = true }) end) + +dap.listeners.before.attach.dapui_config = function() + dapui.open() +end +dap.listeners.before.launch.dapui_config = function() + dapui.open() +end +-- dap.listeners.before.event_terminated.dapui_config = function() +-- dapui.close() +-- end +-- dap.listeners.before.event_exited.dapui_config = function() +-- dapui.close() +-- end diff --git a/_config/nvim/plugins.vim b/_config/nvim/plugins.vim index 388ac22..6420866 100644 --- a/_config/nvim/plugins.vim +++ b/_config/nvim/plugins.vim @@ -35,4 +35,8 @@ Plug 'L3MON4D3/LuaSnip' Plug 'VonHeikemen/lsp-zero.nvim', {'branch': 'v2.x'} Plug 'simrat39/rust-tools.nvim' + +Plug 'mfussenegger/nvim-dap' +Plug 'rcarriga/nvim-dap-ui' +Plug 'nvim-neotest/nvim-nio' call plug#end()