diff options
| author | Aotrix <[email protected]> | 2025-02-23 03:27:58 +0100 |
|---|---|---|
| committer | Aotrix <[email protected]> | 2025-02-23 03:27:58 +0100 |
| commit | 827193de75ecd7dd8da83272aafd036e12d9a573 (patch) | |
| tree | dfc217f21cdad93df7cdc15eb43509dcaf0ab60b /lua/aotrix/plugins/nvim_dap.lua | |
| parent | edf2220385b054af2343402b0c268d2608a96b5b (diff) | |
refactored config
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, +} + |
