54 lines
1.5 KiB
Lua
54 lines
1.5 KiB
Lua
vim.g.mapleader = " "
|
|
vim.g.maplocalleader = " "
|
|
|
|
local opts = { noremap = true, silent = true }
|
|
local keymap = vim.api.nvim_set_keymap
|
|
|
|
keymap("", "<Space>", "<Nop>", opts)
|
|
|
|
--window navigation
|
|
keymap("n", "<C-h>", "<C-w>h", opts)
|
|
keymap("n", "<C-j>", "<C-w>j", opts)
|
|
keymap("n", "<C-k>", "<C-w>k", opts)
|
|
keymap("n", "<C-l>", "<C-w>l", opts)
|
|
|
|
-- Resize with arrows
|
|
keymap("n", "<C-Up>", ":resize +2<CR>", opts)
|
|
keymap("n", "<C-Down>", ":resize -2<CR>", opts)
|
|
keymap("n", "<C-Left>", ":vertical resize -2<CR>", opts)
|
|
keymap("n", "<C-Right>", ":vertical resize +2<CR>", opts)
|
|
|
|
--move text up and down
|
|
keymap("v", "<A-j>", ":m .+1<CR>==", opts)
|
|
keymap("v", "<A-k>", ":m .-2<CR>==", opts)
|
|
keymap("v", "p", '"_dP', opts)
|
|
|
|
keymap("v", "<", "<gv", opts)
|
|
keymap("v", ">", ">gv", opts)
|
|
|
|
-- center view for different commands
|
|
keymap("n", "n", "nzz", opts)
|
|
keymap("n", "N", "Nzz", opts)
|
|
keymap("n", "*", "*zz", opts)
|
|
keymap("n", "#", "#zz", opts)
|
|
keymap("n", "g*", "g*zz", opts)
|
|
keymap("n", "g#", "g#zz", opts)
|
|
keymap("n", "<C-u>", "<C-u>zz", opts)
|
|
keymap("n", "<C-d>", "<C-d>zz", opts)
|
|
|
|
-- Allow moving selected text
|
|
keymap("x", "J", ":move '>+1<CR>gv-gv", opts)
|
|
keymap("x", "K", ":move '<-2<CR>gv-gv", opts)
|
|
keymap("x", "<A-j>", ":move '>+1<CR>gv-gv", opts)
|
|
keymap("x", "<A-k>", ":move '<-2<CR>gv-gv", opts)
|
|
|
|
-- Navigate tabs
|
|
keymap("n", "<S-l>", ":tabnext<CR>", opts)
|
|
keymap("n", "<S-h>", ":tabprevious<CR>", opts)
|
|
|
|
-- Copy to clipboard
|
|
keymap("v", "<C-c>", "\"+y", opts)
|
|
|
|
--Close buffer
|
|
-- keymap("n", "<C-w>", ":bd | bp <CR>", opts)
|