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 keymap('n', ',t', 'j', opts) keymap('n', ',s', 'k', opts) keymap('n', ',c', 'h', opts) keymap('n', ',r', 'l', opts) keymap('n', ',', ':split', opts) keymap('n', ',', ':vsplit', opts) -- jump back from tag keymap('n', ',,', ':pop', opts) -- lexpore navigation keys are not bepo : https://vonheikemen.github.io/devlog/tools/using-netrw-vim-builtin-file-explorer/ -- keymap('n', 'e', ':Lex 20', opts) -- switch to https://github.com/kyazdani42/nvim-tree.lua keymap('n', 'e', ':NvimTreeToggle', opts) -- Resize with 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) -- no not overwrite the register content when past to replace -- 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) -- Telescope keymap("n", "b", "lua require('telescope.builtin').buffers(require('telescope.themes').get_dropdown{previewer = false})", opts) keymap("n", "f", "lua require('telescope.builtin').find_files(require('telescope.themes').get_dropdown{previewer = false})", opts)