mirror of
https://github.com/NotAShelf/neovim-flake.git
synced 2024-11-08 04:35:58 +01:00
42 lines
1.1 KiB
Nix
42 lines
1.1 KiB
Nix
{
|
|
config,
|
|
lib,
|
|
...
|
|
}:
|
|
with lib;
|
|
with builtins; let
|
|
cfg = config.vim.debugger.nvim-dap;
|
|
in {
|
|
config = mkMerge [
|
|
(mkIf cfg.enable {
|
|
vim.startPlugins = ["nvim-dap"];
|
|
|
|
vim.luaConfigRC =
|
|
{
|
|
nvim-dap = nvim.dag.entryAnywhere ''
|
|
local dap = require("dap")
|
|
'';
|
|
}
|
|
// mapAttrs (_: v: (nvim.dag.entryAfter ["nvim-dap"] v)) cfg.sources;
|
|
})
|
|
(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
|
|
'');
|
|
})
|
|
];
|
|
}
|