From d77b55a6d17192a245b2af7548c8fe7a955e0933 Mon Sep 17 00:00:00 2001 From: christianchiarulli Date: Tue, 14 Dec 2021 16:54:41 -0500 Subject: [PATCH 1/3] add keymaps --- init.lua | 1 + lua/user/keymaps.lua | 70 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 71 insertions(+) create mode 100644 lua/user/keymaps.lua diff --git a/init.lua b/init.lua index 1bb93ae..1a3e014 100644 --- a/init.lua +++ b/init.lua @@ -1,3 +1,4 @@ require "user.options" +require "user.keymaps" diff --git a/lua/user/keymaps.lua b/lua/user/keymaps.lua new file mode 100644 index 0000000..fb8fdb4 --- /dev/null +++ b/lua/user/keymaps.lua @@ -0,0 +1,70 @@ +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", "", "h", opts) +keymap("n", "", "j", opts) +keymap("n", "", "k", opts) +keymap("n", "", "l", opts) + +keymap("n", "e", ":Lex 30", 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) + +-- 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) From 4f2899202ef524a0264959feb6e4775b6e82b596 Mon Sep 17 00:00:00 2001 From: christianchiarulli Date: Sat, 18 Dec 2021 23:05:40 -0500 Subject: [PATCH 2/3] remove keymap --- lua/user/keymaps.lua | 4 ---- 1 file changed, 4 deletions(-) diff --git a/lua/user/keymaps.lua b/lua/user/keymaps.lua index fb8fdb4..b4823fe 100644 --- a/lua/user/keymaps.lua +++ b/lua/user/keymaps.lua @@ -37,10 +37,6 @@ keymap("n", "", ":vertical resize +2", opts) 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) From e1ac27496fccd2e0accb79c6ac2097865feff14b Mon Sep 17 00:00:00 2001 From: christianchiarulli Date: Sun, 19 Dec 2021 13:16:43 -0500 Subject: [PATCH 3/3] update resize --- lua/user/keymaps.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lua/user/keymaps.lua b/lua/user/keymaps.lua index b4823fe..b3eb0d8 100644 --- a/lua/user/keymaps.lua +++ b/lua/user/keymaps.lua @@ -28,8 +28,8 @@ keymap("n", "", "l", opts) keymap("n", "e", ":Lex 30", opts) -- Resize with arrows -keymap("n", "", ":resize -2", opts) -keymap("n", "", ":resize +2", opts) +keymap("n", "", ":resize +2", opts) +keymap("n", "", ":resize -2", opts) keymap("n", "", ":vertical resize -2", opts) keymap("n", "", ":vertical resize +2", opts)