From 3c7ac8bf4e9629a9a790c8752274715ba08cc87e Mon Sep 17 00:00:00 2001 From: Nathan Date: Tue, 18 Mar 2025 11:58:38 -0500 Subject: [PATCH] add debug keymaps --- config/default.nix | 20 ++++- config/keybinds.nix | 101 ------------------------ config/keymaps.nix | 188 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 207 insertions(+), 102 deletions(-) delete mode 100644 config/keybinds.nix create mode 100644 config/keymaps.nix diff --git a/config/default.nix b/config/default.nix index 7ce9921..ea27ce4 100644 --- a/config/default.nix +++ b/config/default.nix @@ -6,7 +6,7 @@ ./dap.nix ./lsp.nix ./plugins.nix - ./keybinds.nix + ./keymaps.nix ]; extraPackages = with pkgs; [ @@ -14,6 +14,20 @@ lldb_18 ]; + keymaps = [ + { + mode = "n"; + key = ""; + action = "BufferNext"; + } + + { + mode = "n"; + key = ""; + action = "BufferPrevious"; + } + ]; + opts = { nu = true; rnu = true; @@ -37,6 +51,10 @@ vim.filetype.add({ pattern = { [".*/hypr/.*%.conf"] = "hyprlang" }, }) + + require('dap').listeners.after.event_initialized['dapui_config'] = require('dapui').open + require('dap').listeners.before.event_terminated['dapui_config'] = require('dapui').close + require('dap').listeners.before.event_exited['dapui_config'] = require('dapui').close ''; extraPlugins = with pkgs.vimPlugins; [ diff --git a/config/keybinds.nix b/config/keybinds.nix deleted file mode 100644 index 3ac4ae1..0000000 --- a/config/keybinds.nix +++ /dev/null @@ -1,101 +0,0 @@ -{ ... }: { - - globals = { - mapleader = " "; - maplocalleader = " "; - }; - - keymaps = [ - { - mode = "n"; - key = "ff"; - action = "Telescope find_files hidden=true"; - } - - { - mode = "n"; - key = "fc"; - action = "Telescope treesitter"; - } - - { - mode = "n"; - key = "t"; - action = "NvimTreeToggle"; - } - - { - mode = "n"; - key = ""; - action = "BufferNext"; - } - - { - mode = "n"; - key = ""; - action = "BufferPrevious"; - } - - { - mode = "n"; - key = ""; - action = "wincmd h"; - } - - { - mode = "n"; - key = ""; - action = "wincmd j"; - } - - { - mode = "n"; - key = ""; - action = "wincmd k"; - } - - { - mode = "n"; - key = ""; - action = "wincmd l"; - } - - { - mode = "n"; - key = "Q"; - action = ""; - } - - { - mode = "v"; - key = "J"; - action = ":m '>+1gv=gv"; - } - - { - mode = "v"; - key = "K"; - action = ":m '<-2gv=gv"; - } - - { - mode = "n"; - key = "y"; - action = "\"+y"; - } - - { - mode = "v"; - key = "y"; - action = "\"+y"; - } - - { - mode = "n"; - key = "s"; - action = ":%s/\\<\\>//gI"; - } - ]; - - -} diff --git a/config/keymaps.nix b/config/keymaps.nix new file mode 100644 index 0000000..a980f67 --- /dev/null +++ b/config/keymaps.nix @@ -0,0 +1,188 @@ +{ ... }: { + + globals = { + mapleader = " "; + maplocalleader = " "; + }; + + keymaps = [ + { + mode = "n"; + key = "ff"; + action = "Telescope find_files hidden=true"; + } + + { + mode = "n"; + key = "fc"; + action = "Telescope treesitter"; + } + + { + mode = "n"; + key = "t"; + action = "NvimTreeToggle"; + } + + { + mode = "n"; + key = ""; + action = "BufferNext"; + } + + { + mode = "n"; + key = ""; + action = "BufferPrevious"; + } + + { + mode = "n"; + key = ""; + action = "wincmd h"; + } + + { + mode = "n"; + key = ""; + action = "wincmd j"; + } + + { + mode = "n"; + key = ""; + action = "wincmd k"; + } + + { + mode = "n"; + key = ""; + action = "wincmd l"; + } + + { + mode = "n"; + key = "Q"; + action = ""; + } + + { + mode = "v"; + key = "J"; + action = ":m '>+1gv=gv"; + } + + { + mode = "v"; + key = "K"; + action = ":m '<-2gv=gv"; + } + + { + mode = "n"; + key = "y"; + action = "\"+y"; + } + + { + mode = "v"; + key = "y"; + action = "\"+y"; + } + + { + mode = "n"; + key = "s"; + action = ":%s/\\<\\>//gI"; + } + + { + mode = "n"; + key = ""; + action.__raw = '' + function() + require('dap').continue() + end + ''; + options = { + desc = "Debug: Start/Continue"; + }; + } + { + mode = "n"; + key = ""; + action.__raw = '' + function() + require('dap').step_into() + end + ''; + options = { + desc = "Debug: Step Into"; + }; + } + { + mode = "n"; + key = ""; + action.__raw = '' + function() + require('dap').step_over() + end + ''; + options = { + desc = "Debug: Step Over"; + }; + } + { + mode = "n"; + key = ""; + action.__raw = '' + function() + require('dap').step_out() + end + ''; + options = { + desc = "Debug: Step Out"; + }; + } + { + mode = "n"; + key = "b"; + action.__raw = '' + function() + require('dap').toggle_breakpoint() + end + ''; + options = { + desc = "Debug: Toggle Breakpoint"; + }; + } + { + mode = "n"; + key = "B"; + action.__raw = '' + function() + require('dap').set_breakpoint(vim.fn.input 'Breakpoint condition: ') + end + ''; + options = { + desc = "Debug: Set Breakpoint"; + }; + } + # Toggle to see last session result. Without this, you can't see session output + # in case of unhandled exception. + { + mode = "n"; + key = ""; + action.__raw = '' + function() + require('dapui').toggle() + end + ''; + options = { + desc = "Debug: See last session result."; + }; + } + ]; + + +}