79 lines
2.2 KiB
Lua
79 lines
2.2 KiB
Lua
|
-----------------
|
||
|
-- Normal mode --
|
||
|
-----------------
|
||
|
|
||
|
-- Hint: see `:h vim.map.set()`
|
||
|
-- Better window navigation
|
||
|
vim.keymap.set("n", "<C-h>", "<C-w>h", opts)
|
||
|
vim.keymap.set("n", "<C-j>", "<C-w>j", opts)
|
||
|
vim.keymap.set("n", "<C-k>", "<C-w>k", opts)
|
||
|
vim.keymap.set("n", "<C-l>", "<C-w>l", opts)
|
||
|
|
||
|
-- Resize with arrows
|
||
|
-- delta: 2 lines
|
||
|
vim.keymap.set("n", "<C-Up>", ":resize -2<CR>", opts)
|
||
|
vim.keymap.set("n", "<C-Down>", ":resize +2<CR>", opts)
|
||
|
vim.keymap.set("n", "<C-Left>", ":vertical resize -2<CR>", opts)
|
||
|
vim.keymap.set("n", "<C-Right>", ":vertical resize +2<CR>", opts)
|
||
|
|
||
|
-- open File Explorer
|
||
|
vim.keymap.set("n", "<leader>pv", vim.cmd.Ex)
|
||
|
|
||
|
-- Navigate buffers
|
||
|
vim.keymap.set("n", "<BS>", ":bnext<CR>", opts)
|
||
|
vim.keymap.set("n", "<S-TAB>", ":bprevious<CR>", opts)
|
||
|
|
||
|
-- Telescope
|
||
|
local builtin = require("telescope.builtin")
|
||
|
--vim.keymap.set("n", "<leader>pf", builtin.find_files, {})
|
||
|
--vim.keymap.set("n", "<C-p>", builtin.git_files, {})
|
||
|
--vim.keymap.set("n", "<leader>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", "<leader>a", mark.add_file)
|
||
|
vim.keymap.set("n", "<C-e>", ui.toggle_quick_menu)
|
||
|
|
||
|
vim.keymap.set("n", "<C-h>", function () ui.nav_file(1) end)
|
||
|
vim.keymap.set("n", "<C-t>", function () ui.nav_file(2) end)
|
||
|
vim.keymap.set("n", "<C-n>", function () ui.nav_file(3) end)
|
||
|
vim.keymap.set("n", "<C-s>", function () ui.nav_file(4) end)
|
||
|
|
||
|
-- Undotree
|
||
|
vim.keymap.set("n", "<leader>u", vim.cmd.UndotreeToggle)
|
||
|
|
||
|
-- Fugitive
|
||
|
vim.keymap.set("n", "<leader>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", "<C-d>", "<C-d>zz")
|
||
|
vim.keymap.set("n", "<C-u>", "<C-u>zz")
|
||
|
vim.keymap.set("n", "n", "nzzzv")
|
||
|
vim.keymap.set("n", "N", "Nzzzv")
|
||
|
|
||
|
-- Don't loose buffer
|
||
|
vim.keymap.set("x", "<leader>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)
|
||
|
vim.keymap.set("v", ">", ">gv", opts)
|
||
|
|
||
|
-- Move text on visual mode
|
||
|
vim.keymap.set("v", "J", ":m '>+1<CR>gv=gv", opts)
|
||
|
vim.keymap.set("v", "K", ":m '<-2<CR>gv=gv", opts)
|
||
|
|
||
|
|
||
|
|
||
|
|