local opts = { noremap = true, silent = true } --local term_opts = { silent = true } local bind = vim.api.nvim_set_keymap local set = vim.keymap.set -- bind a leader key bind("", ";", "", opts) -- undo any previous bind vim.g.mapleader = ";" vim.g.maplocalleader = ";" -- Modes -- Normal Mode = 'n', -- Insert Mode = 'i', -- Visual Mode = 'v', -- Visual Block Mode = 'x', -- Terminal Mode = 't', -- Command Mode = 'c', -- Normal mode -- -- Basic functions bind("n", "w", ":w", opts) bind("n", "e", ":q", opts) bind("n", "q", ":qa", opts) -- Nvim tree bind("n", "", ":NvimTreeToggle", opts) -- Fuzzy finder local telescope_status_ok, telescope = pcall(require, "telescope.builtin") if telescope_status_ok then set("n", "ff", telescope.find_files, {}) set("n", "fg", telescope.live_grep, {}) set("n", "fb", telescope.buffers, {}) set("n", "fh", telescope.help_tags, {}) end -- Better tabs --bind("n", "n", ":tabnew", opts) --bind("n", "c", ":tabclose", opts) --bind("n", "l", ":tabnext", opts) --bind("n", "h", ":tabprev", opts) -- Better window navigation bind("n", "", "h", opts) bind("n", "", "j", opts) bind("n", "", "k", opts) bind("n", "", "l", opts) -- Resize with arrows bind("n", "", ":resize -2", opts) bind("n", "", ":resize +2", opts) bind("n", "", ":vertical resize -2", opts) bind("n", "", ":vertical resize +2", opts) -- Navigate tabs bind("n", "", ":tabnew", opts) bind("n", "", ":tabclose", opts) bind("n", "", ":tabp", opts) bind("n", "", ":tabn", opts) -- Visual -- -- Stay in indent mode bind("v", "<", "", ">gv", opts) -- Move text up and down bind("v", "", ":m .+1==", opts) bind("v", "", ":m .-2==", opts) bind("v", "p", '"_dP', opts) -- Visual Block -- -- Move text up and down bind("x", "J", ":move '>+1gv-gv", opts) bind("x", "K", ":move '<-2gv-gv", opts)