local map = vim.keymap.set -- Save/Quit map("n", "w", "w", { desc = "Save" }) map("n", "q", "q", { desc = "Quit" }) -- Better movement with wrapped lines (just in case you turn wrap on) map("n", "j", "gj", { noremap = true }) map("n", "k", "gk", { noremap = true }) -- Clear search highlight map("n", "h", "nohlsearch", { desc = "No highlight" }) -- Diagnostics map("n", "[d", vim.diagnostic.goto_prev, { desc = "Prev diagnostic" }) map("n", "]d", vim.diagnostic.goto_next, { desc = "Next diagnostic" }) map("n", "e", vim.diagnostic.open_float, { desc = "Diagnostic float" }) -- Window navigation map("n", "", "h", { desc = "Left window" }) map("n", "", "j", { desc = "Down window" }) map("n", "", "k", { desc = "Up window" }) map("n", "", "l", { desc = "Right window" }) local diagnostics_visible = true map("n", "td", function() diagnostics_visible = not diagnostics_visible vim.diagnostic.config({ virtual_text = diagnostics_visible, }) end, { desc = "Toggle inline diagnostics" }) vim.keymap.set("n", "]b", "bnext", { desc = "Next buffer" }) vim.keymap.set("n", "[b", "bprevious", { desc = "Previous buffer" }) -- Go to buffer controlls 1-9 for i = 1, 9 do vim.keymap.set("n", "" .. i, function() local bufs = vim.fn.getbufinfo({ buflisted = 1 }) if bufs[i] then vim.api.nvim_set_current_buf(bufs[i].bufnr) end end, { desc = "Go to buffer " .. i }) end -- Delete current buffer (without closing window) vim.keymap.set("n", "bd", function() local current = vim.api.nvim_get_current_buf() vim.cmd("bnext") vim.cmd("bdelete " .. current) end, { desc = "Delete buffer" }) -- Toggle terminal in a bottom split vim.keymap.set("n", "tt", function() vim.cmd("botright split | resize 15 | terminal") end, { desc = "Open terminal (bottom split)" })