aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/dot_config/nvim/lua/plugins/debug.lua
diff options
context:
space:
mode:
authorLibravatar sommerfeld <sommerfeld@sommerfeld.dev>2026-04-21 01:23:18 +0100
committerLibravatar sommerfeld <sommerfeld@sommerfeld.dev>2026-04-21 01:23:18 +0100
commitd00bf2cb2d5087164fa509a4f20a2be62a519044 (patch)
treee788986ca341fa7a9d7327b48c58d2e0c0c43115 /dot_config/nvim/lua/plugins/debug.lua
parent9b2af4dd6c73ea57cc921f41120db7a2700e806d (diff)
downloaddotfiles-d00bf2cb2d5087164fa509a4f20a2be62a519044.tar.gz
dotfiles-d00bf2cb2d5087164fa509a4f20a2be62a519044.tar.bz2
dotfiles-d00bf2cb2d5087164fa509a4f20a2be62a519044.zip
refactor: restructure to chezmoi source state
Rename home/ contents to chezmoi naming conventions: - dot_ prefix for dotfiles and dot-dirs - private_dot_ for .gnupg and .ssh directories - private_ for 0600 files (nym.pub) - executable_ for scripts in .local/bin and display-toggle.sh - symlink_ for mimeapps.list symlink
Diffstat (limited to 'dot_config/nvim/lua/plugins/debug.lua')
-rw-r--r--dot_config/nvim/lua/plugins/debug.lua75
1 files changed, 75 insertions, 0 deletions
diff --git a/dot_config/nvim/lua/plugins/debug.lua b/dot_config/nvim/lua/plugins/debug.lua
new file mode 100644
index 0000000..bef0d1c
--- /dev/null
+++ b/dot_config/nvim/lua/plugins/debug.lua
@@ -0,0 +1,75 @@
+vim.keymap.set("n", "<leader>td", function()
+ require("debugmaster").mode.toggle()
+end, { desc = "[T]oggle [D]ebug mode" })
+
+local dap = require("dap")
+
+local function get_env_vars()
+ local variables = vim.fn.environ()
+ table.insert(variables, { ASAN_OPTIONS = "detect_leaks=0" })
+ return variables
+end
+
+dap.adapters.lldb = {
+ type = "executable",
+ command = "lldb-dap",
+ name = "lldb",
+ env = get_env_vars,
+}
+dap.adapters.gdb = {
+ type = "executable",
+ command = "gdb",
+ args = { "--interpreter=dap" },
+ env = get_env_vars,
+}
+dap.adapters.codelldb = {
+ type = "executable",
+ command = "codelldb",
+ env = get_env_vars,
+}
+
+local function get_program()
+ local _program
+ vim.ui.input({
+ prompt = "Program: ",
+ complete = "file_in_path",
+ }, function(res)
+ _program = res
+ end)
+ return vim.fn.system("which " .. _program):gsub("\n$", "")
+end
+
+local function get_args()
+ local _args
+ vim.ui.input({
+ prompt = "Args: ",
+ default = vim.fn.getreg("+"),
+ complete = "file",
+ }, function(res)
+ _args = res
+ end)
+ return require("dap.utils").splitstr(_args)
+end
+
+dap.configurations.cpp = {
+ {
+ name = "codelldb Launch",
+ type = "codelldb",
+ request = "launch",
+ cwd = "${workspaceFolder}",
+ program = get_program,
+ args = get_args,
+ stopOnEntry = true,
+ console = "integratedTerminal",
+ },
+}
+
+dap.configurations.c = dap.configurations.cpp
+dap.configurations.rust = dap.configurations.cpp
+
+require("nvim-dap-virtual-text").setup({})
+require("mason-nvim-dap").setup({
+ automatic_installation = false,
+ handlers = {},
+ ensure_installed = {},
+})