-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmappings.lua
100 lines (99 loc) · 4.15 KB
/
mappings.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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
-- more in/all objects between 2 characters
local map = vim.keymap.set
for _, char in ipairs { "_", ".", ":", ",", ";", "|", "/", "\\", "*", "+", "%", "`", "?" } do
for _, mode in ipairs { "x", "o" } do
map(mode, "i" .. char, (":<C-u>silent! normal! f%sF%slvt%s<CR>"):format(char, char, char))
map(mode, "a" .. char, (":<C-u>silent! normal! f%sF%svf%s<CR>"):format(char, char, char))
end
end
return {
n = {
-- disable default bindings
["<C-Down>"] = false,
["<C-Left>"] = false,
["<C-Right>"] = false,
["<C-Up>"] = false,
["<C-q>"] = false,
["<C-s>"] = false,
["<"] = false,
[">"] = false,
["<leader>c"] = false,
["<leader>h"] = false,
["<C-\\>"] = false,
["<leader>fh"] = false,
["<leader>fm"] = false,
["<leader>fn"] = false,
["<leader>fo"] = false,
["<leader>sb"] = false,
["<leader>sc"] = false,
["<leader>sh"] = false,
["<leader>sk"] = false,
["<leader>sm"] = false,
["<leader>sn"] = false,
["<leader>sr"] = false,
-- lsp re bindings
["<leader>lR"] = { "<cmd>Lspsaga rename<CR>", desc = "Rename current symbol" },
-- resize with arrows
["<Up>"] = { function() require("smart-splits").resize_up(2) end, desc = "Resize split up" },
["<Down>"] = { function() require("smart-splits").resize_down(2) end, desc = "Resize split down" },
["<Left>"] = { function() require("smart-splits").resize_left(2) end, desc = "Resize split left" },
["<Right>"] = { function() require("smart-splits").resize_right(2) end, desc = "Resize split right" },
-- navigating wrapped lines
j = { "gj", desc = "Navigate down" },
k = { "gk", desc = "Navigate down" },
-- easy splits
["\\"] = { "<cmd>split<cr>", desc = "Horizontal split" },
["|"] = { "<cmd>vsplit<cr>", desc = "Vertical split" },
-- better increment/decrement
["-"] = { "<c-x>", desc = "Descrement number" },
["+"] = { "<c-a>", desc = "Increment number" },
-- Treesitter Surfer
["<c-down>"] = { "<cmd>STSSwapDownNormal<cr>", desc = "Swap next tree-sitter object" },
["<c-right>"] = { "<cmd>STSSwapDownNormal<cr>", desc = "Swap next tree-sitter object" },
["<c-up>"] = { "<cmd>STSSwapUpNormal<cr>", desc = "Swap previous tree-sitter object" },
["<c-left>"] = { "<cmd>STSSwapUpNormal<cr>", desc = "Swap previous tree-sitter object" },
},
i = {
-- type template string
-- [";mk"] = { "<++>", desc = "Insert template string" },
["<S-Tab>"] = { "<C-V><Tab>", desc = "Tab character" },
},
v = {
-- navigating wrapped lines
j = { "gj", desc = "Navigate down" },
k = { "gk", desc = "Navigate down" },
},
-- terminal mappings
t = {
["<esc>"] = false,
["jk"] = false,
["<c-q>"] = { "<c-\\><c-n>", desc = "Terminal normal mode" },
["<esc><esc>"] = { "<c-\\><c-n>:q<cr>", desc = "Terminal quit" },
},
x = {
-- better increment/decrement
["+"] = { "g<c-a>", desc = "Increment number" },
["-"] = { "g<c-x>", desc = "Descrement number" },
-- line text-objects
["il"] = { "g_o^", desc = "Inside line text object" },
["al"] = { "$o^", desc = "Around line text object" },
-- Tressitter Surfer
["J"] = { "<cmd>STSSelectNextSiblingNode<cr>", desc = "Surf next tree-sitter object" },
["K"] = { "<cmd>STSSelectPrevSiblingNode<cr>", desc = "Surf previous tree-sitter object" },
["H"] = { "<cmd>STSSelectParentNode<cr>", desc = "Surf parent tree-sitter object" },
["L"] = { "<cmd>STSSelectChildNode<cr>", desc = "Surf child tree-sitter object" },
["<c-j>"] = { "<cmd>STSSwapNextVisual<cr>", desc = "Surf next tree-sitter object" },
["<c-l>"] = { "<cmd>STSSwapNextVisual<cr>", desc = "Surf next tree-sitter object" },
["<c-k>"] = { "<cmd>STSSwapPrevVisual<cr>", desc = "Surf previous tree-sitter object" },
["<c-h>"] = { "<cmd>STSSwapPrevVisual<cr>", desc = "Surf previous tree-sitter object" },
},
o = {
-- line text-objects
["il"] = { ":normal vil<cr>", desc = "Inside line text object" },
["al"] = { ":normal val<cr>", desc = "Around line text object" },
},
[""] = {
["<c-e><c-e>"] = { "<Plug>SendLine", desc = "Send line to REPL" },
["<c-e>"] = { "<Plug>Send", desc = "Send to REPL" },
},
}