-- Open Ex as buffer -- vim.keymap.set("n", "pv", vim.cmd.Ex, { desc = "Open Ex" }) vim.keymap.set("n", "pv", ":NvimTreeToggle", { desc = "Open Ex" }) -- Exit insert mode without hitting Esc vim.keymap.set("i", "jj", "", { desc = "Esc" }) -- Make Y behave like C or D vim.keymap.set("n", "Y", "y$") -- Keep window centered when going up/down vim.keymap.set("n", "J", "mzJ`z") vim.keymap.set("n", "", "zz") vim.keymap.set("n", "", "zz") vim.keymap.set("n", "n", "nzzzv") vim.keymap.set("n", "N", "Nzzzv") -- Paste without overwriting register vim.keymap.set("v", "p", '"_dP') -- Copy text to " register vim.keymap.set("n", "y", "\"+y", { desc = "Yank into \" register" }) vim.keymap.set("v", "y", "\"+y", { desc = "Yank into \" register" }) vim.keymap.set("n", "Y", "\"+Y", { desc = "Yank into \" register" }) -- Delete text to " register vim.keymap.set("n", "d", "\"_d", { desc = "Delete into \" register" }) vim.keymap.set("v", "d", "\"_d", { desc = "Delete into \" register" }) -- Get out Q vim.keymap.set("n", "Q", "") -- close buffer vim.keymap.set("n", "q", "bd", { desc = "Close Buffer" }) -- Close buffer without closing split vim.keymap.set("n", "w", "bp|bd #", { desc = "Close Buffer; Retain Split" }) -- Navigate between quickfix items vim.keymap.set("n", "h", "cnextzz", { desc = "Forward qfixlist" }) vim.keymap.set("n", ";", "cprevzz", { desc = "Backward qfixlist" }) -- Navigate between location list items vim.keymap.set("n", "k", "lnextzz", { desc = "Forward location list" }) vim.keymap.set("n", "j", "lprevzz", { desc = "Backward location list" }) -- Replace word under cursor across entire buffer vim.keymap.set("n", "s", [[:%s/\<\>//gI]], { desc = "Replace word under cursor" }) -- Make current file executable vim.keymap.set("n", "x", "!chmod +x %", { silent = true, desc = "Make current file executable" }) -- Jump to plugin management file vim.keymap.set("n", "vpp", "e ~/.config/nvim/lua/exosyphon/lazy.lua", { desc = "Jump to lazy.lua" }) -- Git revert at current cursor location vim.keymap.set("n", "U", "GitGutterUndoHunk", { desc = "Revert Git Hunk" }) -- Copy file paths vim.keymap.set("n", "cf", "let @+ = expand(\"%\")", { desc = "Copy File Name" }) vim.keymap.set("n", "cp", "let @+ = expand(\"%:p\")", { desc = "Copy File Path" }) vim.keymap.set("n", "so", function() vim.cmd("so") end, { desc = "Source current file" }) -- Resize with arrows vim.keymap.set("n", "", ":resize +2", { desc = "Resize Horizontal Split Down" }) vim.keymap.set("n", "", ":resize -2", { desc = "Resize Horizontal Split Up" }) vim.keymap.set("n", "", ":vertical resize -2", { desc = "Resize Vertical Split Down" }) vim.keymap.set("n", "", ":vertical resize +2", { desc = "Resize Vertical Split Up" }) -- Open compiler vim.api.nvim_set_keymap('n', '', "CompilerOpen", { noremap = true, silent = true }) -- Redo last selected option vim.api.nvim_set_keymap('n', '', "CompilerStop" -- (Optional, to dispose all tasks before redo) .. "CompilerRedo", { noremap = true, silent = true }) -- Toggle compiler results vim.api.nvim_set_keymap('n', 't', "CompilerToggleResults", { noremap = true, silent = true }) -- Visual -- -- Stay in indent mode vim.keymap.set("v", "<", "", ">gv") -- Move block vim.keymap.set("v", "J", ":m '>+1gv=gv", { desc = "Move Block Down" }) vim.keymap.set("v", "K", ":m '<-2gv=gv", { desc = "Move Block Up" }) -- Search for highlighted text in buffer vim.keymap.set("v", "//", 'y/"', { desc = "Search for highlighted text" })