From 8bc546daf0389b06b4aacb86417059fb47f080e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Moritz=20B=C3=B6hme?= Date: Sat, 28 Oct 2023 15:17:59 +0200 Subject: [PATCH] feat(nvim): add dap nvim --- modules/programs/nvim/plugins/debugger.nix | 49 ++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 modules/programs/nvim/plugins/debugger.nix 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 + ''; + } + ]; + } + ]; +}