local map = vim.keymap.set map("n", "q", "q") map("n", "w", "w") -- Files / search map("n", "e", "Oil", { desc = "File Explorer (oil)" }) map("n", "ff", "Telescope find_files", { desc = "Find files" }) map("n", "fg", "Telescope live_grep", { desc = "Grep" }) map("n", "fb", "Telescope buffers", { desc = "Buffers" }) map("n", "fh", "Telescope help_tags", { desc = "Help" }) -- Git / terminal / diagnostics map("n", "gg", "LazyGit", { desc = "LazyGit" }) map("n", "tt", "ToggleTerm", { desc = "Terminal" }) map("n", "xx", "Trouble diagnostics toggle", { desc = "Diagnostics (Trouble)" }) -- LSP map("n", "rn", vim.lsp.buf.rename, { desc = "LSP Rename" }) map({ "n", "v" }, "ca", vim.lsp.buf.code_action, { desc = "LSP Code Action" }) map("n", "gd", vim.lsp.buf.definition, { desc = "Go to definition" }) map("n", "K", vim.lsp.buf.hover, { desc = "Hover" }) -- Format map("n", "lf", function() require("conform").format({ async = true }) end, { desc = "Format" }) -- QoL map("n", "s", [[:%s/\s\+$//e]], { desc = "Strip trailing spaces" }) -- Neotree -- Focus the sidebar (or open it if closed) map("n", "nf", function() require("neo-tree.command").execute({ action = "focus", source = "filesystem", position = "left" }) end, { desc = "Neo-tree: focus sidebar" }) -- Reveal current file in the sidebar (and focus it) map("n", "fE", "Neotree reveal left", { desc = "Neo-tree: reveal current file" })