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
|
-- https://github.com/arnvald/viml-to-lua/blob/main/lua/mappings.lua
vim.cmd('noremap <C-b> :noh<cr>:call clearmatches()<cr>') -- clear matches Ctrl+b
function Map(mode, shortcut, command)
vim.api.nvim_set_keymap(mode, shortcut, command, { noremap = true, silent = true })
end
function Nmap(shortcut, command)
Map('n', shortcut, command)
end
function Imap(shortcut, command)
Map('i', shortcut, command)
end
function Vmap(shortcut, command)
Map('v', shortcut, command)
end
function Cmap(shortcut, command)
Map('c', shortcut, command)
end
function Tmap(shortcut, command)
Map('t', shortcut, command)
end
--- pane nav
Nmap("<c-k>", ":wincmd k<CR>")
Nmap("<c-j>", ":wincmd j<CR>")
Nmap("<c-h>", ":wincmd h<CR>")
Nmap("<c-l>", ":wincmd l<CR>")
--- pane resize
Nmap("_", ":resize -1<CR>")
Nmap("+", ":resize +1<CR>")
Nmap("<", ":vertical:resize -1<CR>")
Nmap(">", ":vertical:resize +1<CR>")
-- pane spawn
Nmap("t", ':split<CR>:wincmd j<CR>:term<CR>')
Nmap("s", ':vs<CR>:wincmd l<CR>')
-- escape terminal mode easier
Tmap('<Esc>', '<C-\\><C-n>')
|