-- Open Ex as buffer vim.keymap.set("n", "pv", vim.cmd.Ex, { 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"}) -- Run Tests vim.keymap.set("n", "t", "lua require('neotest').run.run()", { desc = "Run Test"}) vim.keymap.set("n", "tf", "lua require('neotest').run.run(vim.fn.expand('%'))", { desc = "Run Test File"} ) vim.keymap.set("n", "td", "lua require('neotest').run.run(vim.fn.getcwd())", { desc = "Run Current Test Directory"}) vim.keymap.set("n", "tp", "lua require('neotest').output_panel.toggle()", { desc = "Toggle Test Output Panel"}) vim.keymap.set("n", "tl", "lua require('neotest').run.run_last()", { desc = "Run Last Test"}) vim.keymap.set("n", "ts", "lua require('neotest').summary.toggle()", { desc = "Toggle Test Summary"}) -- Debug Tests vim.keymap.set("n", "dt", "DapContinue", { desc = "Start Debugging"}) vim.keymap.set("n", "dc", "DapContinue", { desc = "Start Debugging"}) vim.keymap.set("n", "dso", "DapStepOver", { desc = "Step Over"}) vim.keymap.set("n", "dsi", "DapStepInto", { desc = "Step Into"}) vim.keymap.set("n", "dsu", "DapStepOut", { desc = "Step Out"}) vim.keymap.set("n", "dst", "DapStepTerminate", { desc = "Stop Debugger"}) vim.keymap.set("n", "b", "lua require'dap'.toggle_breakpoint()", { desc = "Toggle Breakpoint"}) vim.keymap.set("n", "B", "lua require'dap'.set_breakpoint(vim.fn.input('Breakpoint condition: '))", { desc = "Toggle Breakpoint Condition"}) vim.keymap.set("n", "E", "lua require'dap'.set_exception_breakpoints()", { desc = "Toggle Exception Breakpoint"}) vim.keymap.set("n", "dr", "lua require'dapui'.float_element('repl', { width = 100, height = 40, enter = true })", { desc = "Show DAP REPL"}) vim.keymap.set("n", "ds", "lua require'dapui'.float_element('scopes', { width = 150, height = 50, enter = true })", { desc = "Show DAP Scopes"}) vim.keymap.set("n", "df", "lua require'dapui'.float_element('stacks', { width = 150, height = 50, enter = true })", { desc = "Show DAP Stacks"}) vim.keymap.set("n", "db", "lua require'dapui'.float_element('breakpoints', { enter = true })", { desc = "Show DAP breakpoints"}) vim.keymap.set("n", "do", "lua require'dapui'.toggle()", { desc = "Toggle DAP UI"}) vim.keymap.set("n", "dl", "lua require'dap'.run_last()", { desc = "Debug Last Test"}) -- 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", "", function() vim.cmd("so") end, { desc = "Source current file"}) -- Open Zoxide telescope extension vim.keymap.set("n", "Z", "Zi", { desc = "Open Zoxide"}) -- 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"}) -- 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"})