summaryrefslogtreecommitdiff
path: root/.config/nvim/lua/mango/remap.lua
diff options
context:
space:
mode:
authorThomas Voss <mail@thomasvoss.com> 2023-09-12 12:17:08 +0200
committerThomas Voss <mail@thomasvoss.com> 2023-09-12 12:17:08 +0200
commit74858f94885c3bc9cef98a128a4710c2c2b99177 (patch)
tree73889360bcf232da3e9ffaa7ab3fba9f71c9e338 /.config/nvim/lua/mango/remap.lua
parent24fc98bfaca3f07c90ff33a3bfeb738fd84ff79a (diff)
nvim: Include more Neovim configurations
Diffstat (limited to '.config/nvim/lua/mango/remap.lua')
-rw-r--r--.config/nvim/lua/mango/remap.lua45
1 files changed, 45 insertions, 0 deletions
diff --git a/.config/nvim/lua/mango/remap.lua b/.config/nvim/lua/mango/remap.lua
new file mode 100644
index 0000000..3c4c526
--- /dev/null
+++ b/.config/nvim/lua/mango/remap.lua
@@ -0,0 +1,45 @@
+local function remap(modes, from, to)
+ modes:gsub('.', function(c)
+ vim.keymap.set(c, from, to)
+ end)
+end
+
+vim.g.mapleader = ' '
+
+-- Make adjustments for my custom keyboard layout
+remap('nv', '€', '$')
+remap('nv', ')', '0')
+remap('n', '<', '<<')
+remap('n', '>', '>>')
+
+-- Open netrw
+remap('n', '<leader>rw', vim.cmd.Ex)
+
+-- Better frame navigation
+remap('n', '<C-h>', '<C-w>h')
+remap('n', '<C-j>', '<C-w>j')
+remap('n', '<C-k>', '<C-w>k')
+remap('n', '<C-l>', '<C-w>l')
+
+-- I prefer visual-line mode on ‘V’
+remap('n', 'V', '<C-v>')
+remap('n', '<C-v>', 'V')
+
+-- Move selections up and down
+remap('v', '<C-J>', ":m '>+1<CR>gv=gv")
+remap('v', '<C-K>', ":m '<-2<CR>gv=gv")
+
+-- Don’t move cursor with various commands
+remap('n', 'J', 'mzJ`z')
+remap('n', '<C-d>', '<C-d>zz')
+remap('n', '<C-u>', '<C-u>zz')
+remap('n', 'n', 'nzzzv')
+remap('n', 'N', 'Nzzzv')
+
+-- Paste and delete without clobbering primary register
+remap('x', '<leader>p', '"_dP')
+remap('nv', '<leader>d', '"_d')
+
+-- Copy to system clipboard
+remap('vn', '<leader>y', '"+y')
+remap('n', '<leader>Y', '"+Y')