require "nvchad.mappings" local map = vim.keymap.set -- Quick command mode map("n", ";", ":", { desc = "CMD enter command mode" }) map("i", "jk", "", { desc = "Escape insert mode" }) -- Save with Ctrl+S map({ "n", "i", "v" }, "", "w", { desc = "Save file" }) -- ── Git ────────────────────────────────────────────────────────────────────── map("n", "gg", "LazyGit", { desc = "Open LazyGit" }) -- ── Diagnostics (Trouble) ──────────────────────────────────────────────────── map("n", "xx", "Trouble diagnostics toggle", { desc = "Workspace diagnostics" }) map("n", "xb", "Trouble diagnostics toggle filter.buf=0", { desc = "Buffer diagnostics" }) map("n", "xs", "Trouble symbols toggle focus=false", { desc = "Document symbols" }) map("n", "xl", "Trouble lsp toggle focus=false win.position=right", { desc = "LSP references" }) map("n", "xq", "Trouble qflist toggle", { desc = "Quickfix list" }) -- ── DAP ────────────────────────────────────────────────────────────────────── map("n", "db", "DapToggleBreakpoint", { desc = "Toggle breakpoint" }) map("n", "dB", function() require("dap").set_breakpoint(vim.fn.input "Condition: ") end, { desc = "Conditional breakpoint" }) map("n", "dc", "DapContinue", { desc = "Continue" }) map("n", "di", "DapStepInto", { desc = "Step into" }) map("n", "do", "DapStepOver", { desc = "Step over" }) map("n", "dO", "DapStepOut", { desc = "Step out" }) map("n", "dt", "DapTerminate", { desc = "Terminate" }) map("n", "du", function() require("dapui").toggle() end, { desc = "Toggle DAP UI" }) map("n", "dr", function() require("dap").repl.open() end,{ desc = "Open REPL" }) map("n", "dgt", function() require("dap-go").debug_test() end, { desc = "Debug Go test" }) map("n", "dgl", function() require("dap-go").debug_last_test() end, { desc = "Debug last Go test" }) -- ── Terminal ────────────────────────────────────────────────────────────────── map("n", "tf", "ToggleTerm direction=float", { desc = "Float terminal" }) map("n", "th", "ToggleTerm direction=horizontal", { desc = "Horizontal terminal" }) map("n", "tv", "ToggleTerm direction=vertical", { desc = "Vertical terminal" }) -- ── TODO comments ───────────────────────────────────────────────────────────── map("n", "ft", "TodoTelescope", { desc = "Find TODOs" }) map("n", "]t", function() require("todo-comments").jump_next() end, { desc = "Next TODO" }) map("n", "[t", function() require("todo-comments").jump_prev() end, { desc = "Prev TODO" }) -- ── Harpoon ─────────────────────────────────────────────────────────────────── map("n", "ha", function() require("harpoon"):list():add() end, { desc = "Add file" }) map("n", "hh", function() local h = require "harpoon" h.ui:toggle_quick_menu(h:list()) end, { desc = "Toggle menu" }) map("n", "h1", function() require("harpoon"):list():select(1) end, { desc = "File 1" }) map("n", "h2", function() require("harpoon"):list():select(2) end, { desc = "File 2" }) map("n", "h3", function() require("harpoon"):list():select(3) end, { desc = "File 3" }) map("n", "h4", function() require("harpoon"):list():select(4) end, { desc = "File 4" }) -- cycle through harpoon list map("n", "hp", function() require("harpoon"):list():prev() end, { desc = "Prev file" }) map("n", "hn", function() require("harpoon"):list():next() end, { desc = "Next file" }) -- ── Oil ─────────────────────────────────────────────────────────────────────── map("n", "-", "Oil", { desc = "Open parent dir (Oil)" }) map("n", "oo", "Oil --float", { desc = "Oil (float)" }) -- ── AI (Minuet inline completions) ─────────────────────────────────────────── map("i", "", function() require("minuet").make_cmp_map() end, { desc = "Minuet: trigger completion" }) map("n", "", function() require("minuet").complete_with_minuet() end, { desc = "Minuet: inline suggestion" }) -- ── which-key group labels ──────────────────────────────────────────────────── vim.schedule(function() local ok, wk = pcall(require, "which-key") if not ok then return end wk.add { { "a", group = "AI" }, { "d", group = "Debug" }, { "dg", group = "Go" }, { "x", group = "Diagnostics" }, { "t", group = "Terminal" }, { "g", group = "Git" }, { "h", group = "Harpoon" }, { "o", group = "Oil" }, { "f", group = "Find" }, } end)