nixos-combined-flake/modules/nixvim/plugins/dap.nix

125 lines
2.4 KiB
Nix

{pkgs, ...}: {
plugins.dap = {
enable = true;
extensions = {
dap-ui.enable = true;
dap-go.enable = true;
dap-python.enable = true;
dap-virtual-text.enable = true;
};
adapters = {
executables = {
gdb = {
command = "${pkgs.gdb}/bin/gdb";
args = ["--interpreter=dap" "--eval-command" "set pretty print on"];
};
};
};
configurations = rec {
c = cpp;
rust = cpp;
cpp = [
{
name = "Launch";
request = "launch";
type = "gdb";
cwd = "\${workspaceFolder}";
stopOnEntry = false;
runInTerminal = true;
program = {
__raw = ''
get_program
'';
};
}
{
name = "Launch with Arguments";
request = "launch";
type = "gdb";
cwd = "\${workspaceFolder}";
stopOnEntry = false;
runInTerminal = true;
program = {
__raw = ''
get_program
'';
};
args = {
__raw = ''
function()
local arguments_string = vim.fn.input('Executable arguments: ')
return vim.split(arguments_string, " +")
end
'';
};
}
];
};
};
keymaps = [
{
action = ":DapToggleBreakpoint<CR>";
key = "<leader>db";
options = {
silent = true;
};
}
{
action = ":DapUiToggle<CR>";
key = "<leader>du";
options = {
silent = true;
};
}
{
action = ":DapContinue<CR>";
key = "<leader>dc";
options = {
silent = true;
};
}
{
action = ":DapRerun<CR>";
key = "<leader>dC";
options = {
silent = true;
};
}
{
action = ":DapStepOver<CR>";
key = "<leader>do";
options = {
silent = true;
};
}
{
action = ":DapStepIn<CR>";
key = "<leader>di";
options = {
silent = true;
};
}
{
action = ":DapStepOut<CR>";
key = "<leader>dO";
options = {
silent = true;
};
}
{
action = ":DapTerminate<CR>";
key = "<leader>dT";
options = {
silent = true;
};
}
{
action = ":DapToggleRepl<CR>";
key = "<leader>dr";
options = {
silent = true;
};
}
];
}