-- changed silent to false, b/c for now I have the space for it, -- and prefer verbosity! local opts = { noremap = true, silent = false } -- Terminal options for. local term_opts = { silent = true } -- Shorten function name. 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", -- 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) -- Toggle NetRW Plugin for now... 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) -- 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) -- Insert -- -- Press jk fast to enter Normal-mode, from Insert-mode. keymap("i", "jk", "", opts) -- Visual -- -- Stay in indent mode. -- I like this idea. keymap("v", "<", "", ">gv", opts) -- Move text highlights up & down. 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) -- ########################################################## -- ## Map nn, to toggle regular line-numberings on, # -- ## to check for which specific line of the file your on. # -- ########################################################## keymap("n", "lno", ":set nonu", opts) -- Turn line-numbers OFF. keymap("n", "ln", ":set nu", opts) -- Turn line-numbers back on. -- ################################################################### -- ## Map nr to toggle off the relative line numbers in Normal mode. # -- ################################################################### keymap("n", "nno", ":set nornu", opts) -- Turn relative line-numbers OFF. keymap("n", "rn", ":set rnu", opts) -- Turn relative line-numbers back on. -- ########################################################################### -- ##I'm mapping comma{,} + lower-case 'l' to disable special char listings. # -- ########################################################################### keymap("n", "nls", ":set nolist", opts) -- Turn special hidden chars OFF. keymap("n", "ls", ":set list", opts) -- Turn List(ls) mode back on. -- ############################################################################### -- ## cm == copy-mode. disables special characters($) and relative-line-numbers. # -- ############################################################################### keymap("n", "cm", ":set nolist :set nornu :set nonu ", opts) -- ############################################################## -- ## Spell check set to sc(Spell-Check)/es(Switch 2 ESpaƱol.). # -- ############################################################## keymap("n", "sc", ":setlocal spell! spelllang=en_us", opts) keymap("n", "es", ":set spelllang=es", opts) -- ######################################################################### -- ## hotkey mappings for jumps, marks, buffer-LiSting, and changes lists. # -- ######################################################################### keymap("n", "mm", ":marks", opts) -- This will open up the Marks-list. keymap("n", "jj", ":jumps", opts) -- This will open up the Jumps-list. keymap("n", "ll", ":ls", opts) -- This opens up the buffers-list. keymap("n", "cc", ":changes", opts) -- This will open up the Changes-list. keymap("n", "rr", ":registers", opts) -- This will open up the Registers-list. -- ######################################################################### -- ## Adding some hotkeys to more easily deal with splits. # -- ## qq == :q aka quit file. You will be prompted if the file is unsaved. # -- ## wq == :wq aka Save and quit. # -- ## qa == :qa! aka quit the file without saving # -- ## w == :w aka save(write) file. # -- ######################################################################### keymap("n", "qq", ":q", opts) keymap("n", "wq", ":wq", opts) keymap("n", "qa", ":qa!", opts) keymap("n", "s", ":w", opts) -- ################## -- ## Mark-keymaps: # -- ################## keymap("n", "dm", ":delmarks!", opts) -- Delete ALL marks: -- ################# -- # TAB keymaps: # -- ################# keymap("n", "tn", ":tabnew ", opts) -- New-tab keymap("n", "bt", "gT", opts) -- Backward-tab(s) keymap("n", "ft", "gt", opts) -- Forward-tab(s) keymap("n", "tc", ":tabclose", opts) -- Close-tab keymap("n", "db", ":bd", opts) -- Delete-Buffer -- ############################################################################### -- # Split-keymaps: # -- #The following combos split the view, and it is up to you to switch to # -- #different files or locations in a large file perhaps. # -- #*~In a powershell or cmd prompt, there is possibly no session or # -- #tmux|screen|byobu or jobs like functionality I've been able to find. # -- #Although clink 4 cmd does have history/jab-control, but sadly no shell-view # -- #multi-plexing. :( # -- ############################################################################### keymap("n", "sp", ":split", opts) -- Splits current view horizontally. keymap("n", "vp", ":vsplit", opts) -- Splits current view Vertically. -- ################################################## -- ## I'm mapping vc to reload the .vimrc, # -- ## without closing and re-opening he vim config. # -- ################################################## -- keymap("n", "vc", ":source ~/.config/nvim/init.lua :nohl ", opts) -- TODO attempt to put this in vim.cmd later. -- Terminal -- -- Better terminal navigation... ??? -- This is the ONLY block I am not sure if I want to include in my config, -- b/c I don't understand what it does; so I'll disable it for now... -- keymap("t", "", "h", term_opts) -- keymap("t", "", "j", term_opts) -- keymap("t", "", "k", term_opts) -- keymap("t", "", "l", term_opts)