----------------- -- Normal mode -- ----------------- -- Hint: see `:h vim.map.set()` -- Better window navigation vim.keymap.set("n", "", "h", opts) vim.keymap.set("n", "", "j", opts) vim.keymap.set("n", "", "k", opts) vim.keymap.set("n", "", "l", opts) -- Resize with arrows -- delta: 2 lines vim.keymap.set("n", "", ":resize -2", opts) vim.keymap.set("n", "", ":resize +2", opts) vim.keymap.set("n", "", ":vertical resize -2", opts) vim.keymap.set("n", "", ":vertical resize +2", opts) -- open File Explorer vim.keymap.set("n", "pv", vim.cmd.Ex) -- Navigate buffers vim.keymap.set("n", "", ":bnext", opts) vim.keymap.set("n", "", ":bprevious", opts) -- Telescope local builtin = require("telescope.builtin") --vim.keymap.set("n", "pf", builtin.find_files, {}) --vim.keymap.set("n", "", builtin.git_files, {}) --vim.keymap.set("n", "ps", function () -- builtin.grep_string( { search = vim.fn.input("Grep > ") } ); --end) -- Harpoon local mark = require("harpoon.mark") local ui = require("harpoon.ui") vim.keymap.set("n", "a", mark.add_file) vim.keymap.set("n", "", ui.toggle_quick_menu) vim.keymap.set("n", "", function () ui.nav_file(1) end) vim.keymap.set("n", "", function () ui.nav_file(2) end) vim.keymap.set("n", "", function () ui.nav_file(3) end) vim.keymap.set("n", "", function () ui.nav_file(4) end) -- Undotree vim.keymap.set("n", "u", vim.cmd.UndotreeToggle) -- Fugitive vim.keymap.set("n", "gs", vim.cmd.Git) -- Put line bellow in-front of line vim.keymap.set("n", "J", "mzJ`z") -- Keep cursor in the middle vim.keymap.set("n", "", "zz") vim.keymap.set("n", "", "zz") vim.keymap.set("n", "n", "nzzzv") vim.keymap.set("n", "N", "Nzzzv") -- Don't loose buffer vim.keymap.set("x", "p", "\"_dP") ----------------- -- Visual mode -- ----------------- -- Hint: start visual mode with the same area as the previous area and the same mode vim.keymap.set("v", "<", "", ">gv", opts) -- Move text on visual mode vim.keymap.set("v", "J", ":m '>+1gv=gv", opts) vim.keymap.set("v", "K", ":m '<-2gv=gv", opts)