-- Thank you ThePrimeagen --------------- -- Move when highlighted vim.keymap.set('v', 'J', ":m '>+1gv=gv"); vim.keymap.set('v', 'K', ":m '<-2gv=gv"); -- Make cursor stay in place when using J vim.keymap.set('n', 'J', 'mzJ`z'); -- Make cursor stay in the middle when jumping -- with ctrl+d and ctrl+u vim.keymap.set('n', '', 'zz'); vim.keymap.set('n', '', 'zz'); -- Just to be sure, whatever vim.keymap.set('n', '', ''); -- Don't press Q vim.keymap.set('n', 'Q', ''); -- Delete to the void vim.keymap.set('n', 'd', '\"_d'); vim.keymap.set('v', 'd', '\"_d'); -- Replace current word in entire file vim.keymap.set("n", "s", [[:%s/\<\>//gI]]) -- Turn file into a Linux executable vim.keymap.set('n', 'x', '!chmod +x %', { silent = true }); -- -------------------------------------- vim.keymap.set('n', 'w\\', ':vsplit', { desc = '[w\\] Splits the window vertically' }); vim.keymap.set('n', 'w/', ':split', { desc = '[w/] Splits the window horizontally' }); vim.keymap.set('n', 's=', 'z=', { desc = '[s=] Suggest spelling correction' }); vim.keymap.set('n', 'st', function() if vim.o.spell then vim.o.spell = false; else vim.o.spell = true; end end, { desc = '[st] Toggle spelling correction' });