-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmaps.lua
62 lines (46 loc) · 1.2 KB
/
maps.lua
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
local map = require('utils').map
vim.g.mapleader = ' '
map('i', 'jk', '<Esc>')
-- Redo
map('n', 'U', '<C-R>')
-- Change text without putting into register
map('n', 'c', '"_c')
map('n', 'cc', '"_cc')
-- Replace selection with text in reg
map('v', 'p', '"_dP')
-- Movement
map('n', 'H', '^')
map('n', 'L', 'g_')
map('v', 'H', '^')
map('v', 'L', 'g_')
-- Continuous visual shifting
map('v', '>', '>gv')
map('v', '<', '<gv')
-- Keep cursor position after yanking
map('v', 'y', 'myy`y')
-- Add empty line
map('n', '<leader>o', 'o<Esc>')
map('n', '<leader>O', 'O<Esc>')
-- Jump to match items
map('n', '<Tab>', '%', { remap = true })
-- Clear search
map('n', '<leader><space>', ':nohls<CR>')
-- Save file
map('n', '<leader>s', ':w<CR>')
-- Split window
map('n', '<leader>w', '<C-w>')
map('n', '<leader>ww', '<C-w>c')
map('n', '<leader>h', '<C-w>h')
map('n', '<leader>j', '<C-w>j')
map('n', '<leader>k', '<C-w>k')
map('n', '<leader>l', '<C-w>l')
-- Buffer
map('n', '<C-n>', ':bnext<CR>')
map('n', '<C-p>', ':bprevious<CR>')
map('n', '<leader>x', ':Bdelete<CR>')
map('n', '<leader>X', ':bufdo :Bdelete<CR>')
-- Run Command easier
map('n', ';', ':')
map('n', ':', ';')
-- Terminal
map('t', '<S-Esc>', [[<C-\><C-n>]])