diff options
Diffstat (limited to 'lua/aotrix/plugins/nvim_dap.lua')
| -rw-r--r-- | lua/aotrix/plugins/nvim_dap.lua | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/lua/aotrix/plugins/nvim_dap.lua b/lua/aotrix/plugins/nvim_dap.lua new file mode 100644 index 0000000..19ab17e --- /dev/null +++ b/lua/aotrix/plugins/nvim_dap.lua @@ -0,0 +1,51 @@ +return { + 'mfussenegger/nvim-dap', + dependencies = { + 'rcarriga/nvim-dap-ui', + 'theHamsta/nvim-dap-virtual-text', + 'nvim-neotest/nvim-nio', + 'williamboman/mason.nvim', + }, + + config = function() + local dap = require("dap") + local ui = require("dapui") + + require("dapui").setup() + require("nvim-dap-virtual-text").setup() + require("mason").setup() + + dap.adapters.codelldb = { + type = "executable", + command = "codelldb", -- or if not in $PATH: "/absolute/path/to/codelldb" + } + + dap.configurations.cpp = { + { + 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, + }, + } + + dap.listeners.before.attach.dapui_config = function() + ui.open() + end + dap.listeners.before.launch.dapui_config = function() + ui.open() + end + dap.listeners.before.event_terminated.dapui_config = function() + ui.close() + end + dap.listeners.before.event_exited.dapui_config = function() + ui.close() + end + + end, +} + |
