diff --git a/init.lua b/init.lua index de352c2..5746313 100644 --- a/init.lua +++ b/init.lua @@ -2,9 +2,15 @@ -- Please remember the lua @ the begining & end of the string are implied. -- In other words "user.abbrs" is the same as "lua.user.abbrs" | "user.abbrs.lua" | "lua.user.abbrs.lua". require "user.options" +<<<<<<< HEAD -- I have auto-commands for cursor-file persistance, -- auto. vertically centering, & auto-saving text-folds. require "user.autocmds" -- Abbreviations for manual text-replacements. -- Populated mostly with a top 100 list of commonly misspelled words. require "user.abbrs" +======= +require "user.keymaps" + + +>>>>>>> e1ac27496fccd2e0accb79c6ac2097865feff14b diff --git a/lua/user/keymaps.lua b/lua/user/keymaps.lua new file mode 100644 index 0000000..b3eb0d8 --- /dev/null +++ b/lua/user/keymaps.lua @@ -0,0 +1,66 @@ +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) + +-- 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)