-- Global/editor keymaps live here. -- Tip: keep them conservative so they don't surprise language buffers. -- Global/editor keymaps only (language-specific go in e.g. c/keybindings.lua) local map = vim.keymap.set -- Save / quit (kept from earlier) -- map("n", "w", "write", { desc = "Write file" }) map("n", "q", "quit", { desc = "Quit window" }) -- File explorer (loads Neo-tree on demand) map("n", "ee", "Neotree toggle", { desc = "Explorer: toggle" }) map("n", "er", "Neotree reveal", { desc = "Explorer: reveal current file" }) map("n", "ef", "Neotree focus", { desc = "Explorer: focus" }) -- === Splits === -- Horizontal split (under your left hand) map("n", "-", "split", { desc = "Split: horizontal" }) -- Vertical split (pipe looks like a vertical divider) map("n", "|", "vsplit", { desc = "Split: vertical" }) -- === Window navigation (hjkl with Ctrl) === -- These mirror Vim's native h/j/k/l but are faster to type map("n", "", "h", { desc = "Window left" }) map("n", "", "j", { desc = "Window down" }) map("n", "", "k", { desc = "Window up" }) map("n", "", "l", { desc = "Window right" }) -- which-key groups (v3 list-style spec) local ok, wk = pcall(require, "which-key") -- this will load the plugin if needed if ok then wk.add({ { "e", group = "Explorer" }, { "f", group = "Find" }, { "g", group = "Git" }, { "w", group = "Write/Windows" }, -- optional grouping for your own keys }) end -- Find group (which-key already labels f as "Find") map("n", "ff", "Telescope find_files", { desc = "Find files" }) map("n", "fg", "Telescope live_grep", { desc = "Grep project" }) map("n", "fb", "Telescope buffers", { desc = "Switch buffer" }) map("n", "fh", "Telescope help_tags", { desc = "Help tags" }) map("n", "fr", "Telescope oldfiles", { desc = "Recent files" }) map("n", "fs", "Telescope grep_string", { desc = "Grep word under cursor" }) local tb = require("telescope.builtin") map("n", "fs", tb.lsp_workspace_symbols, { desc = "Find: workspace symbols (LSP fuzzy)" }) map("n", "fd", tb.lsp_document_symbols, { desc = "Find: document symbols (LSP fuzzy)" }) -- Open a small hover with all diagnostics at the cursor map("n", "xx", "Trouble diagnostics toggle", { desc="Diagnostics: Trouble list" }) -- Toggle right-side virtual text on/off (sometimes nice to declutter) map("n", "xt", function() local cfg = vim.diagnostic.config() vim.diagnostic.config({ virtual_text = not cfg.virtual_text }) end, { desc = "Diagnostics: toggle virtual text" })