local opts = { noremap = true, silent = true } local term_opts = { silent = true } -- Shorten function name local keymap = vim.api.nvim_set_keymap --Remap space as leader key keymap("", "", "", opts) vim.g.mapleader = " " vim.g.maplocalleader = " " -- Modes -- normal_mode = "n", -- insert_mode = "i", -- visual_mode = "v", -- visual_block_mode = "x", -- term_mode = "t", -- command_mode = "c", -- Normal -- -- Better window navigation (both hjkl and arrow keys) keymap("n", "", "h", opts) keymap("n", "", "j", opts) keymap("n", "", "k", opts) keymap("n", "", "l", opts) keymap("n", "", "h", opts) keymap("n", "", "j", opts) keymap("n", "", "k", opts) keymap("n", "", "l", opts) -- Better tab navigation (both hjkl and arrow keys) keymap("n", "", "gT", opts) keymap("n", "", "gt", opts) keymap("n", "", "gT", opts) keymap("n", "", "gt", opts) -- Navigate buffers keymap("n", "", ":bnext", opts) keymap("n", "", ":bprevious", opts) -- Open Lexplorer --keymap("n", "e", ":Lex 30", opts) -- Resize with ctrl+shift+arrows keymap("n", "", ":resize -2", opts) keymap("n", "", ":resize +2", opts) keymap("n", "", ":vertical resize -2", opts) keymap("n", "", ":vertical resize +2", opts) --[[ -- Navigate buffers keymap("n", "", ":bnext", opts) keymap("n", "", ":bprevious", opts) -- Move text up and down keymap("n", "", ":m .+1==gi", opts) keymap("n", "", ":m .-2==gi", opts) -- Insert -- -- Press jk fast to enter keymap("i", "jk", "", opts) -- Visual -- -- Stay in indent mode keymap("v", "<", "", ">gv", opts) -- Move text up and down keymap("v", "", ":m .+1==", opts) keymap("v", "", ":m .-2==", opts) keymap("v", "p", '"_dP', opts) -- Visual Block -- -- Move text up and down keymap("x", "J", ":move '>+1gv-gv", opts) keymap("x", "K", ":move '<-2gv-gv", opts) keymap("x", "", ":move '>+1gv-gv", opts) keymap("x", "", ":move '<-2gv-gv", opts) -- Terminal -- -- Better terminal navigation keymap("t", "", "h", term_opts) keymap("t", "", "j", term_opts) keymap("t", "", "k", term_opts) keymap("t", "", "l", term_opts) ]] -- Buffer Options keymap("n", "bd", ":b#:bd#", opts) --Close buffer without closing window ('b'uffer 'd'elete) keymap("n", "bl", ":JABSOpen", opts) --Open buffer switcher ('b'uffer 'l'ist) -- Toggle GUI colors keymap("n", "g", ":set termguicolors!:TSToggle highlight", opts) -- ('g'ui) -- LSP options - see lsp/handlers.lua -- Telescope options keymap("n", "t", ":Telescope ", opts) -- ('t'elescope) keymap("n", "tf", ":Telescope find_files", opts) -- ('f'ind_files) keymap("n", "ts", ":Telescope live_grep", opts) -- ('s'tring) keymap("n", "tb", ":Telescope buffers", opts) -- ('b'uffers) keymap("n", "td", ":Telescope diagnostics", opts) -- ('d'iagnostics) keymap("n", "th", ":Telescope keymaps", opts) -- ('h'elp) keymap("n", "tt", ":Telescope treesitter", opts) -- ('t'reesitter) -- Workspace Options keymap("n", "wsh", ":split", opts) --Horizontal split workspace ('s'plit 'h'orizontal) keymap("n", "wsv", ":vs", opts) --Vertical split workspace ('s'plit 'v'ertical)