local set = vim.keymap.set -- Prevent continue comment on new line vim.api.nvim_create_autocmd( "FileType", { pattern = "*", command = [[setlocal formatoptions-=c formatoptions-=r formatoptions-=o]] } ) vim.opt.wildignore = "*/.git/*,*/.DS_Store/*,*/target/*,*/node_modules/*" vim.opt.expandtab = true -- stay in indent mode only set("v", "<", "", ">gv") -- Move lines by selecting set("v", "J", ":m '>+1gv=gv") set("v", "K", ":m '<-2gv=gv") -- Keep yaa head straight set("n", "", "zz") set("n", "", "zz") -- Navigate with Netrw set("n", "n", vim.cmd.Ex, { desc = "Open [N]etrw" }) -- Prime said this is greatest remap ever set("x", "p", [["_dP]]) -- Next greatest reamap set({ "n", "v" }, "d", [["_d]]) -- Set highlight on search, but clear on pressing in normal mode vim.opt.hlsearch = true set("n", "", "nohlsearch") -- Diagnostic keymaps set("n", "[d", vim.diagnostic.goto_prev, { desc = "Go to previous [D]iagnostic message" }) set("n", "]d", vim.diagnostic.goto_next, { desc = "Go to next [D]iagnostic message" }) set("n", "q", vim.diagnostic.setloclist, { desc = "Open diagnostic [Q]uickfix list" }) set("n", "e", vim.diagnostic.open_float, { desc = "Show diagnostic [E]rror messages" }) -- Disable arrow keys in normal mode set("n", "", 'echo "Use h to move!!"') set("n", "", 'echo "Use l to move!!"') set("n", "", 'echo "Use k to move!!"') set("n", "", 'echo "Use j to move!!"') -- Highlight when yanking (copying) text vim.api.nvim_create_autocmd("TextYankPost", { desc = "Highlight when yanking (copying) text", group = vim.api.nvim_create_augroup("highlight-yank", { clear = true }), callback = function() vim.highlight.on_yank() end, })