From 21ac8ff9b9289eb62e5f5493a350a26a5b5fb8b1 Mon Sep 17 00:00:00 2001 From: Kevin James Lausen Date: Fri, 3 Jun 2022 22:16:25 -0400 Subject: [PATCH] Added +nn/nr/nr, for no-num/no-rel-num/no-list. --- lua/user/keymaps.lua | 106 +++++++++++++++++++++++++------------------ 1 file changed, 61 insertions(+), 45 deletions(-) diff --git a/lua/user/keymaps.lua b/lua/user/keymaps.lua index 94d5b65..827fdff 100644 --- a/lua/user/keymaps.lua +++ b/lua/user/keymaps.lua @@ -1,50 +1,50 @@ -- changed silent to false, b/c for now I have the space for it, -- and prefer verbosity! -local opts = { noremap = true, silent = false } + local opts = { noremap = true, silent = false } -- Terminal options for. -local term_opts = { silent = true } + local term_opts = { silent = true } -- Shorten function name. -local keymap = vim.api.nvim_set_keymap + local keymap = vim.api.nvim_set_keymap --Re-map space as leader key. --I already did this on vim & neovim(init.vim). -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", + 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 -- Exactly what I would have done... -keymap("n", "", "h", opts) -keymap("n", "", "j", opts) -keymap("n", "", "k", opts) -keymap("n", "", "l", opts) + keymap("n", "", "h", opts) + keymap("n", "", "j", opts) + keymap("n", "", "k", opts) + keymap("n", "", "l", opts) -- Toggle NetRW Plugin for now... -keymap("n", "e", ":Lex 30", opts) + keymap("n", "e", ":Lex 30", opts) -- Resize with with Ctrl-Up/Down/Left/Right. -- Tweaked slightly like on the Video-series. -keymap("n", "", ":resize +2", opts) -keymap("n", "", ":resize -2", opts) -keymap("n", "", ":vertical resize +2", opts) -keymap("n", "", ":vertical 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) -- Navigate buffers. -- I like changing buffers this way, -- b/c I was running into problems w/ Ctrl-f/b. -keymap("n", "", ":bnext", opts) -keymap("n", "", ":bprevious", opts) + keymap("n", "", ":bnext", opts) + keymap("n", "", ":bprevious", opts) -- Insert -- -- Press jk fast to enter Normal-mode, from Insert-mode. @@ -53,33 +53,49 @@ keymap("i", "jk", "", opts) -- Visual -- -- Stay in indent mode. -- I like this idea. -keymap("v", "<", "", ">gv", opts) + keymap("v", "<", "", ">gv", opts) -- Move text highlights up & down. -keymap("v", "", ":m .+1==", opts) -keymap("v", "", ":m .-2==", opts) -keymap("v", "p", '"_dP', opts) + keymap("v", "", ":m .+1==", opts) + keymap("v", "", ":m .-2==", opts) + keymap("v", "p", '"_dP', opts) -- Subltle change, but if you paste over a visual selection; -- Now it won't put what you pasted over into the 2-be-pasted-next buffer. -- Visual Block -- -- Move full lines Up/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) - ---"############################ ---"# leader-mappings section: # ---"############################ - keymap( "n", "top", ":set paste", opts) -- Turn special pasting on ONLY when needed. - ---"################################################################ ---"# Toggle highlight searching. # ---"# Map nh to toggle off the search highlighting in Normal mode. # ---"################################################################ - keymap( "n", "nh", ":nohl", opts) + 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) + +-- "############################ +-- "# leader-mappings section: # +-- "############################ + keymap("n", "top", ":set paste", opts) -- Turn special pasting on ONLY when needed. + +-- "################################################################ +-- "# Toggle highlight searching. # +-- "# Map nh to toggle off the search highlighting in Normal mode. # +-- "################################################################ + keymap("n", "nh", ":nohl", opts) + +-- "################################################################## +-- "# Map nr to toggle off the relative line numbers in Normal mode. # +-- "################################################################## + keymap("n", "nr", ":set nornu", opts) + +-- "######################################################### +-- "# Map n, to toggle regular line-numberings on, # +-- "# to check for which specific line of the file your on. # +-- "######################################################### + keymap("n", "nn", ":set nonu", opts) + +-- "########################################################################## +-- "#I'm mapping comma{,} + lower-case 'l' to disable special char listings. # +-- "########################################################################## + keymap("n", "nl", ":set nolist", opts) -- Terminal -- -- Better terminal navigation... ???