+/config

my dotfiles and nix configuration

git clone https://git.julia.blue/+/config

Julia RyanUpdate nvim and nixd0b27c7

main
3.0 KiB97 linesraw
1local dap = require "dap"
2
3require("dap-python").setup()
4require("nvim-dap-virtual-text").setup()
5
6dap.adapters.rr = { type = "executable", command = "rr" }
7dap.adapters.lldb = { type = "executable", command = "lldb" }
8dap.adapters.rust_lldb = { type = "executable", command = "rust-lldb" }
9local port = 17776
10dap.adapters.codelldb = {
11    type = "server",
12    port = 17776,
13    executable = { command = "codelldb", args = { "--port", 17776 } },
14}
15dap.adapters.gdb = {
16    type = "executable",
17    command = "gdb",
18    args = { "--interpreter=dap", "--eval-command", "set print pretty on" },
19}
20dap.adapters.rust_gdb =
21    { type = "executable", command = "rust-gdb", args = { "--interpreter=dap" } }
22
23dap.configurations.cpp = {
24    {
25        name = "Attach to process",
26        type = "cpp", -- Adjust this to match your adapter name (`dap.adapters.<name>`)
27        request = "attach",
28        pid = require("dap.utils").pick_process,
29        args = {},
30    },
31}
32
33local gdb_configs = {
34    launch = {
35        name = "Launch",
36        type = "gdb",
37        request = "launch",
38        program = function()
39            return vim.fn.input("Path to executable: ", vim.fn.getcwd() .. "/", "file")
40        end,
41        cwd = "${workspaceFolder}",
42        stopAtBeginningOfMainSubprogram = false,
43    },
44    attach = {
45        name = "Select and attach to process",
46        type = "gdb",
47        request = "attach",
48        program = function()
49            return vim.fn.input("Path to executable: ", vim.fn.getcwd() .. "/", "file")
50        end,
51        pid = function()
52            local name = vim.fn.input "Executable name (filter): "
53            return require("dap.utils").pick_process { filter = name }
54        end,
55        cwd = "${workspaceFolder}",
56    },
57    server = {
58        name = "Attach to gdbserver :1234",
59        type = "gdb",
60        request = "attach",
61        target = "localhost:1234",
62        program = function()
63            return vim.fn.input("Path to executable: ", vim.fn.getcwd() .. "/", "file")
64        end,
65        cwd = "${workspaceFolder}",
66    },
67}
68
69local lldb = {
70    name = "Launch lldb",
71    type = "lldb",
72    request = "launch",
73    program = function()
74        return vim.fn.input("Path to executable: ", vim.fn.getcwd() .. "/", "file")
75    end,
76    cwd = "${workspaceFolder}",
77    stopOnEntry = false,
78    runInTerminal = false,
79    args = {},
80}
81
82dap.configurations.c = {
83    lldb,
84}
85dap.configurations.cpp = dap.configurations.c
86dap.configurations.rust = dap.configurations.c
87
88local function sign(name, tbl)
89    local default = { text = "", texthl = "", linehl = "", numhl = "" }
90    vim.fn.sign_define(name, vim.tbl_extend("force", default, tbl))
91end
92
93sign("DapStopped", { text = "→", texthl = "DapStopped" })
94sign("DapLogPoint", { text = "◆", texthl = "DapLogPoint" })
95sign("DapBreakpoint", { text = "●", texthl = "DapBreakpoint" })
96sign("DapBreakpointRegected", { text = "", texthl = "DapBreakpointRegected" })
97sign("DapBreakpointCondition", { text = "", texthl = "DapBreakpointCondition" })