-- ====================================================================== -- keymaps.lua — Key mappings -- ====================================================================== local map = vim.keymap.set -- NERDTree map("n", "n", ":NERDTreeFocus", { silent = true, desc = "NERDTree: Focus" }) map("n", "", ":NERDTree", { silent = true, desc = "NERDTree: Open" }) map("n", "", ":NERDTreeToggle", { silent = true, desc = "NERDTree: Toggle" }) map("n", "", ":NERDTreeFind", { silent = true, desc = "NERDTree: Find current file" }) -- OSC52 (vim-oscyank) map("n", "c", "OSCYankOperator", { desc = "OSC Yank: Operator" }) map("n", "cc", "c_", { desc = "OSC Yank: Current line" }) map("v", "c", "OSCYankVisual", { desc = "OSC Yank: Visual selection" }) -- vim-slime vim.g.slime_no_mappings = 1 map("x", "", "SlimeRegionSend", { desc = "Slime: Send region" }) map("n", "", function() require("utils").send_cell("^#%%") end, { silent = true, desc = "Slime: Send cell" }) map("n", "v", "SlimeConfig", { desc = "Slime: Configure" }) -- Claude Code map("n", "ac", ":ClaudeCode", { silent = true, desc = "ClaudeCode: Toggle" }) map("n", "af", ":ClaudeCodeFocus", { silent = true, desc = "ClaudeCode: Focus" }) map("v", "as", ":ClaudeCodeSend", { silent = true, desc = "ClaudeCode: Send selection" }) map("n", "ad", ":ClaudeCodeAdd ", { desc = "ClaudeCode: Add file to context" }) map("n", "aa", ":ClaudeCodeDiffAccept", { silent = true, desc = "ClaudeCode: Accept diff" }) map("n", "ar", ":ClaudeCodeDiffDeny", { silent = true, desc = "ClaudeCode: Reject diff" }) -- DAP (GDB) local function dap_attach_or(fn) return function(...) local dap = require("dap") if dap.session() then return fn(dap, ...) end if vim.fn.exists(":Hazard3Attach") == 2 then vim.cmd("Hazard3Attach") return end return fn(dap, ...) end end map("n", "", dap_attach_or(function(dap) dap.continue() end), { desc = "DAP: Continue (or Hazard3Attach)" }) map("n", "", dap_attach_or(function(dap) dap.step_over() end), { desc = "DAP: Step over" }) map("n", "", dap_attach_or(function(dap) dap.step_into() end), { desc = "DAP: Step into" }) map("n", "", dap_attach_or(function(dap) dap.step_out() end), { desc = "DAP: Step out" }) map("n", "db", function() require("dap").toggle_breakpoint() end, { desc = "DAP: Toggle breakpoint" }) map("n", "dB", function() require("dap").set_breakpoint(vim.fn.input("Condition: ")) end, { desc = "DAP: Conditional breakpoint" }) map("n", "dr", function() require("dap").repl.open() end, { desc = "DAP: REPL" }) map("n", "du", function() require("dapui").toggle() end, { desc = "DAP: Toggle UI" }) map("n", "dR", function() local dapui = require("dapui") dapui.close() dapui.open({ reset = true }) end, { desc = "DAP UI: Reset layout" }) map("n", "da", function() require("hazard3_dap").open_disassembly() end, { desc = "DAP: Disassembly" }) map("n", "di", dap_attach_or(function(dap) dap.step_into({ granularity = "instruction" }) end), { desc = "DAP: Step instruction into" }) map("n", "dI", dap_attach_or(function(dap) dap.step_over({ granularity = "instruction" }) end), { desc = "DAP: Step instruction over" }) map("n", "dx", function() require("dap").terminate() end, { desc = "DAP: Terminate" }) map("n", "dp", function() require("dap").pause() end, { desc = "DAP: Pause" })