diff --git a/init.lua b/init.lua index 35407841..4c149735 100644 --- a/init.lua +++ b/init.lua @@ -1026,7 +1026,7 @@ require('lazy').setup({ -- This is the easiest way to modularize your config. -- -- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going. - -- { import = 'custom.plugins' }, + { import = 'custom.plugins' }, -- -- For additional information with loading, sourcing and examples see `:help lazy.nvim-🔌-plugin-spec` -- Or use telescope! diff --git a/lazy-lock.json b/lazy-lock.json index 1957faf5..942f1b43 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -9,7 +9,6 @@ "gitsigns.nvim": { "branch": "main", "commit": "68114837e81ca16d06514c3a997c9102d1b25c15" }, "lazy.nvim": { "branch": "main", "commit": "d8f26efd456190241afd1b0f5235fe6fdba13d4a" }, "lazydev.nvim": { "branch": "main", "commit": "8620f82ee3f59ff2187647167b6b47387a13a018" }, - "luvit-meta": { "branch": "main", "commit": "55709f183b0742a7e4f47688c284f81148ad4dc0" }, "mason-lspconfig.nvim": { "branch": "main", "commit": "97d9f1d3ad205dece6bcafd1d71cf1507608f3c7" }, "mason-tool-installer.nvim": { "branch": "main", "commit": "c5e07b8ff54187716334d585db34282e46fa2932" }, "mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" }, @@ -18,7 +17,12 @@ "nui.nvim": { "branch": "main", "commit": "53e907ffe5eedebdca1cd503b00aa8692068ca46" }, "nvim-autopairs": { "branch": "master", "commit": "d2f791ceeb26d04d87aa54343bc94e8ad8d7be1c" }, "nvim-cmp": { "branch": "main", "commit": "8c82d0bd31299dbff7f8e780f5e06d2283de9678" }, + "nvim-dap": { "branch": "master", "commit": "52302f02fea3a490e55475de52fa4deb8af2eb11" }, + "nvim-dap-python": { "branch": "master", "commit": "34282820bb713b9a5fdb120ae8dd85c2b3f49b51" }, + "nvim-dap-ui": { "branch": "master", "commit": "bc81f8d3440aede116f821114547a476b082b319" }, + "nvim-dap-virtual-text": { "branch": "master", "commit": "df66808cd78b5a97576bbaeee95ed5ca385a9750" }, "nvim-lspconfig": { "branch": "master", "commit": "88157521e890fe7fdf18bee22438875edd6300a6" }, + "nvim-nio": { "branch": "master", "commit": "21f5324bfac14e22ba26553caf69ec76ae8a7662" }, "nvim-treesitter": { "branch": "master", "commit": "306dd6e9dc806db1d79568d26e1c9b6c98b95fbc" }, "nvim-treesitter-context": { "branch": "master", "commit": "d0dd7ce5a9d0be1f28086e818e52fdc5c78975df" }, "nvim-web-devicons": { "branch": "master", "commit": "aafa5c187a15701a7299a392b907ec15d9a7075f" }, diff --git a/lua/custom/plugins/nvim-dap.lua b/lua/custom/plugins/nvim-dap.lua new file mode 100644 index 00000000..09292002 --- /dev/null +++ b/lua/custom/plugins/nvim-dap.lua @@ -0,0 +1,86 @@ +return { + { + 'mfussenegger/nvim-dap', + dependencies = { + 'nvim-neotest/nvim-nio', + 'rcarriga/nvim-dap-ui', + 'mfussenegger/nvim-dap-python', + 'theHamsta/nvim-dap-virtual-text', + }, + config = function() + local dap = require 'dap' + local dapui = require 'dapui' + local dap_python = require 'dap-python' + + require('dapui').setup {} + require('nvim-dap-virtual-text').setup { + commented = true, -- Show virtual text alongside comment + } + + dap_python.setup 'uv' + + vim.fn.sign_define('DapBreakpoint', { + text = '', + texthl = 'DiagnosticSignError', + linehl = '', + numhl = '', + }) + + vim.fn.sign_define('DapBreakpointRejected', { + text = '', -- or "❌" + texthl = 'DiagnosticSignError', + linehl = '', + numhl = '', + }) + + vim.fn.sign_define('DapStopped', { + text = '', -- or "→" + texthl = 'DiagnosticSignWarn', + linehl = 'Visual', + numhl = 'DiagnosticSignWarn', + }) + + -- Automatically open/close DAP UI + dap.listeners.after.event_initialized['dapui_config'] = function() + dapui.open() + end + + local opts = { noremap = true, silent = true } + + -- Toggle breakpoint + vim.keymap.set('n', 'db', function() + dap.toggle_breakpoint() + end, opts) + + -- Continue / Start + vim.keymap.set('n', 'dc', function() + dap.continue() + end, opts) + + -- Step Over + vim.keymap.set('n', 'do', function() + dap.step_over() + end, opts) + + -- Step Into + vim.keymap.set('n', 'di', function() + dap.step_into() + end, opts) + + -- Step Out + vim.keymap.set('n', 'dO', function() + dap.step_out() + end, opts) + + -- Keymap to terminate debugging + vim.keymap.set('n', 'dq', function() + require('dap').terminate() + end, opts) + + -- Toggle DAP UI + vim.keymap.set('n', 'du', function() + dapui.toggle() + end, opts) + end, + }, +}