1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
local lib = require('mango.lib')
local remap = lib.remap
vim.g.mapleader = ' '
-- Make adjustments for my custom keyboard layout
remap('nv', '€', '$')
remap('nv', ')', '0')
-- I only ever shift entire lines
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('nv', '<leader>y', '"+y')
remap('n', '<leader>Y', '"+Y')
-- Paste from system clipboard
remap('i', '<C-+>', '"+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
remap('n', '<leader>t', transpose_chars)
remap('n', '<leader>T', function()
transpose_chars(true)
end)
-- Open netrw in a vertical split
remap('n', '–', function()
vim.cmd('vsplit | Ex')
end)
remap('n', 'g–', function()
vim.cmd('split | Ex')
end)
|