From 225c795749a68088c1e33d58ac66209a06ee62a7 Mon Sep 17 00:00:00 2001 From: Nathan Reiner Date: Mon, 6 Apr 2026 09:33:22 +0200 Subject: 2026-04-06 updates by auto-switch --- common/home/programs/nixvim/default.nix | 61 ++++++++++++++++++++++++- common/home/programs/nixvim/plugins/dap.nix | 31 +++++++++---- common/home/programs/nixvim/plugins/default.nix | 5 +- 3 files changed, 83 insertions(+), 14 deletions(-) (limited to 'common/home/programs/nixvim') diff --git a/common/home/programs/nixvim/default.nix b/common/home/programs/nixvim/default.nix index e89c1d5..92308be 100644 --- a/common/home/programs/nixvim/default.nix +++ b/common/home/programs/nixvim/default.nix @@ -1,4 +1,4 @@ -{ pkgs, ... }: +{ pkgs, lib, ... }: { enable = true; defaultEditor = true; @@ -38,6 +38,8 @@ vim.api.nvim_set_hl(0, "NormalNC", { bg = "none" }) vim.api.nvim_set_hl(0, "NeoTreeNormal", { bg = "none" }) vim.api.nvim_set_hl(0, "NeoTreeNormalNC", { bg = "none" }) + + require('dap').set_log_level('TRACE') ''; diagnostic.settings = { @@ -83,7 +85,7 @@ colorscheme = "gruvbox-dark-pale"; }; - plugins = import ./plugins/default.nix { inherit pkgs; }; + plugins = import ./plugins/default.nix { inherit pkgs; inherit lib; }; globals = { mapleader = ","; @@ -136,6 +138,61 @@ action = "lua vim.diagnostic.open_float()"; mode = "n"; } + { + key = "ds"; + action = "DapNew"; + mode = "n"; + } + { + key = "db"; + action = "DapToggleBreakpoint"; + mode = "n"; + } + { + key = "dc"; + action = "DapContinue"; + mode = "n"; + } + { + key = ""; + action = "DapStepOver"; + mode = "n"; + } + { + key = ""; + action = "DapStepInto"; + mode = "n"; + } + { + key = "do"; + action = "DapStepOut"; + mode = "n"; + } + { + key = "dr"; + action = "DapRestartFrame"; + mode = "n"; + } + { + key = "dt"; + action = "DapTerminate"; + mode = "n"; + } + { + key = "de"; + action = "lua require('dapui').eval(vim.fn.input('Eval: '))"; + mode = "n"; + } + { + key = "dv"; + action = "lua require('dapui').toggle()"; + mode = "n"; + } + { + key = "cr"; + action = "source $MYVIMRC"; + mode = "n"; + } { key = "a"; action = "ä"; mode = "i"; } { key = "o"; action = "ö"; mode = "i"; } { key = "u"; action = "ü"; mode = "i"; } diff --git a/common/home/programs/nixvim/plugins/dap.nix b/common/home/programs/nixvim/plugins/dap.nix index 88a3ae0..7707bc8 100644 --- a/common/home/programs/nixvim/plugins/dap.nix +++ b/common/home/programs/nixvim/plugins/dap.nix @@ -1,18 +1,29 @@ -{ ... }: +{ lib, ... }: { enable = true; adapters = { - qemu = { - type = "server"; - host = "localhost"; - port = 1234, + executables.qemu = { + command = "gdb"; + args = [ + "-i" "dap" + ]; }; }; configurations = { - zig = { - name = "Zig Qemu"; - type = "qemu"; - request: "attach"; - }; + zig = [ + { + name = "Qemu"; + type = "qemu"; + request = "attach"; + program = lib.nixvim.mkRaw '' + function() + return vim.fn.input("Path to executable: ", vim.fn.getcwd() .. "/zig-out/bin/", "file") + end + ''; + target = "tcp:localhost:1234"; + stopOnEntry = true; + gdbTarget = "tcp:localhost:1234"; + } + ]; }; } diff --git a/common/home/programs/nixvim/plugins/default.nix b/common/home/programs/nixvim/plugins/default.nix index b199a36..dca17b3 100644 --- a/common/home/programs/nixvim/plugins/default.nix +++ b/common/home/programs/nixvim/plugins/default.nix @@ -1,4 +1,4 @@ -{ pkgs, ... }: +{ pkgs, lib, ... }: let plugins = [ "web-devicons" @@ -9,6 +9,7 @@ plugins = [ "typst-preview" "gitgutter" "dap" + "dap-ui" ]; in builtins.listToAttrs ( @@ -16,7 +17,7 @@ builtins.listToAttrs ( name = n; value = if builtins.pathExists ./${n}.nix then - (import ./${n}.nix { inherit pkgs; }) + (import ./${n}.nix { inherit pkgs; inherit lib; }) else { enable = true; }; }) plugins -- cgit v1.2.3-70-g09d2