67 lines
1.8 KiB
Lua
67 lines
1.8 KiB
Lua
local opts = { noremap = true, silent = true }
|
|
|
|
local term_opts = { silent = true }
|
|
|
|
local keymap = vim.api.nvim_set_keymap
|
|
|
|
keymap("", "<Space>", "<Nop>", opts)
|
|
|
|
vim.g.mapleader = " "
|
|
vim.g.maplocalleader = " "
|
|
|
|
--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)
|
|
|
|
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 buffers
|
|
keymap("n", "<S-l>", ":bnext<CR>", opts)
|
|
keymap("n", "<S-h>", ":bprevious<CR>", opts)
|
|
|
|
--Close buffer
|
|
keymap("n", "<C-w>", ":bd | bp <CR>", opts)
|
|
|
|
--Format document
|
|
keymap("n", "<leader>F", ":lua vim.lsp.buf.format() <CR>", opts)
|
|
|
|
keymap("n", "<leader>ff",
|
|
"<cmd>lua require'telescope.builtin'.find_files(require('telescope.themes').get_dropdown({ previewer = false }))<cr>",
|
|
opts)
|
|
keymap("n", "<leader>fw",
|
|
"<cmd>lua require'telescope.builtin'.live_grep()<cr>",
|
|
opts)
|
|
|
|
|
|
keymap("n", "<leader>e", ":Neotree toggle <CR>", opts)
|