local lib = require('mango.lib') local remap = lib.remap vim.g.mapleader = ' ' -- Make adjustments for my custom keyboard layout remap('nv', '€', '$') -- Open netrw remap('n', 'rw', vim.cmd.Ex) -- Better frame navigation remap('n', '', 'h') remap('n', '', 'j') remap('n', '', 'k') remap('n', '', 'l') -- I prefer visual-line mode on ‘V’ remap('n', 'V', '') remap('n', '', 'V') -- Move selections up and down remap('v', '', ":m '<-2gv=gv") remap('v', '', ":m '>+1gv=gv") -- Don’t move cursor with various commands remap('n', 'J', 'mzJ`z') remap('n', '', 'zz') remap('n', '', 'zz') remap('n', 'n', 'nzzzv') remap('n', 'N', 'Nzzzv') -- Paste and delete without clobbering primary register remap('x', 'p', '"_dP') remap('nv', 'd', '"_d') -- Copy to system clipboard remap('nv', 'y', '"+y') remap('n', 'Y', '"+Y') -- Paste from system clipboard remap('i', '', '"+pa') -- Swap the jump-to-mark bindings remap('nv', "'", '`') remap('nv', '`', "'") -- Transpose characters without clobbering registers local function transpose_chars(rev) lib.save_regs('a', function() vim.cmd.normal('"a' .. (rev and 'X' or 'x') .. '"ap') end) end -- Transpose characters remap('n', 't', transpose_chars) remap('n', 'T', function() transpose_chars(true) end) -- Open netrw in a vertical split remap('n', '–', function() vim.cmd('vsplit | Ex') end) -- Open netrw in a horizontal split remap('n', 'g–', function() vim.cmd('split | Ex') end)