diff --git a/modules/programs/nvim/plugins/debugger.nix b/modules/programs/nvim/plugins/debugger.nix new file mode 100644 index 0000000..4dd93b1 --- /dev/null +++ b/modules/programs/nvim/plugins/debugger.nix @@ -0,0 +1,49 @@ +{ pkgs, lib, ... }: + +with builtins; +{ + config.home-manager.users.moritz.programs.neovim.lazy.plugins = with pkgs.vimPlugins; [ + { + plugin = nvim-dap; + keys = [ + { key = "cb"; cmd = "lua require('dap').toggle_breakpoint()"; desc = "Toggle breakpoint"; } + { key = "cd"; cmd = "lua require('dap').continue()"; desc = "Continue"; } + ]; + dependencies = [ + { + plugin = nvim-dap-python; + ft = [ "python" ]; + conf = + let + pythonWithDebugpy = pkgs.python3.withPackages (ps: with ps; [ debugpy ]); + in + /* lua */ '' + require("dap-python").setup("${lib.getExe pythonWithDebugpy}") + ''; + } + { + plugin = nvim-dap-virtual-text; + opts = { }; + } + { + plugin = nvim-dap-ui; + opts = { }; + conf = /* lua */ '' + local dap = require("dap") + local dapui = require("dapui") + dapui.setup(opts) + dap.listeners.after.event_initialized["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 + ''; + } + ]; + } + ]; +}