nvf/modules/debugger/nvim-dap/config.nix

39 lines
933 B
Nix
Raw Normal View History

2023-05-04 15:41:11 +00:00
{
config,
lib,
...
}:
with lib;
with builtins; let
cfg = config.vim.debugger.nvim-dap;
in {
2023-05-05 13:31:55 +00:00
config = mkMerge [
(mkIf cfg.enable {
vim.startPlugins = ["nvim-dap"];
2023-05-04 15:41:11 +00:00
2023-05-05 13:31:55 +00:00
vim.luaConfigRC.nvim-dap =
nvim.dag.entryAnywhere ''
'';
})
(mkIf (cfg.enable && cfg.ui.enable) {
vim.startPlugins = ["nvim-dap-ui"];
vim.luaConfigRC.nvim-dap-ui = nvim.dag.entryAfter ["nvim-dap"] (''
local dapui = require("dapui")
require("dapui").setup()
''
+ optionalString cfg.ui.autoStart ''
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
'');
})
];
2023-05-04 15:41:11 +00:00
}