-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathkeymaps.lua
More file actions
32 lines (26 loc) · 1.21 KB
/
keymaps.lua
File metadata and controls
32 lines (26 loc) · 1.21 KB
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
-- define common options
local opts = {
noremap = true, -- non-recursive
silent = true,
}
-- NORMAL MODE ----------------------------------------------------------------
-- window navigation 用 <C-h/j/k/l> 快速在多窗口之间移动光标
vim.keymap.set('n', '<C-h>', '<C-w>h', opts)
vim.keymap.set('n', '<C-j>', '<C-w>j', opts)
vim.keymap.set('n', '<C-k>', '<C-w>k', opts)
vim.keymap.set('n', '<C-l>', '<C-w>l', opts)
-- resize window with arrows
vim.keymap.set('n', '<C-Up>', ':resize -2<CR>', opts)
vim.keymap.set('n', '<C-Down>', ':resize +2<CR>', opts)
vim.keymap.set('n', '<C-Left>', ':vertical -2<CR>', opts)
vim.keymap.set('n', '<C-Right>', ':vertical +2<CR>', opts)
-- VISUAL MODE ----------------------------------------------------------------
-- 模式下可以一直用 Tab 或者 Shift-Tab 改变缩进
vim.keymap.set('v', '<', '<gv', opts)
vim.keymap.set('v', '>', '>gv', opts)
-- TERMINAL MODE ---------------------------------------------------------------
-- Type <S-Space> but got ;2u issue
-- https://github.com/vim/vim/issues/6040#issuecomment-827176487
vim.keymap.set('t', '<S-Space>', '<Space>', opts)
-- <LEADER> KEY ---------------------------------------------------------------
vim.g.mapleader = " "