local bind = vim.keymap.set local opts = { silent = true } --Remap space as leader key bind("", "", "", opts) bind("n", "q", "", opts) bind("n", "Q", "", opts) vim.g.mapleader = " " -- Modes -- normal_mode = "n", -- insert_mode = "i", -- visual_mode = "v", -- visual_block_mode = "x", -- term_mode = "t", -- command_mode = "c", -- Normal -- bind("n", "", "zz", opts) bind("n", "", "zz", opts) bind("n", "n", "nzzzv", opts) bind("n", "N", "Nzzzv", opts) -- Better window navigation with tmux bind("n", "", "TmuxNavigateLeft", opts) bind("n", "", "TmuxNavigateDown", opts) bind("n", "", "TmuxNavigateUp", opts) bind("n", "", "TmuxNavigateRight", 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 buffers -- bind("n", "", "bnext", opts) -- bind("n", "", "bprevious", opts) -- Better paste bind("v", "p", '"_dP', opts) -- Move current line / block with Alt-j/k ala vscode bind("n", "", "m .+1==", opts) bind("n", "", "m .-2==", opts) -- QuickFix bind("n", "]q", "cnext", opts) bind("n", "[q", "cprev", opts) bind("n", "", ":%s/\\<\\>//gI", {}) bind("n", "", "mzJ`z") -- Insert -- -- Press jk fast to enter bind("i", "jk", "", opts) -- Move current line / block with Alt-j/k ala vscode. bind("i", "", "m .+1==gi", opts) bind("i", "", "m .-2==gi", opts) -- navigation bind("i", "", "k", opts) bind("i", "", "j", opts) bind("i", "", "h", opts) bind("i", "", "l", opts) -- Visual -- -- Stay in indent mode bind("v", "<", "", ">gv", opts) -- bind("v", "", "m '>+1gv=gv") -- bind("v", "", "m '<-2gv=gv") -- Visual Block -- -- Move current line / block with Alt-j/k ala vscode. -- bind("x", "", "move '>+1gv-gv", opts) -- bind("x", "", "move '<-2gv-gv", opts) -- Command -- -- navigate tab completion with and -- runs conditionally bind("c", "", 'pumvisible() ? "\\" : "\\"', { expr = true, noremap = true }) bind("c", "", 'pumvisible() ? "\\" : "\\"', { expr = true, noremap = true }) -- Terminal -- -- Terminal window navigation bind("t", "", "h", opts) bind("t", "", "j", opts) bind("t", "", "k", opts) bind("t", "", "l", opts) bind("n", "", "w!!compiler '%:p'") bind("n", "", "w!!opout '%:p'")