-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwhich-key.lua
259 lines (252 loc) · 7.56 KB
/
which-key.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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
return function()
local icons = {
ui = require("modules.utils.icons").get("ui"),
misc = require("modules.utils.icons").get("misc"),
}
require("which-key").setup({
plugins = {
presets = {
operators = false,
motions = false,
text_objects = true,
windows = true,
nav = true,
z = true,
g = true,
},
},
icons = {
breadcrumb = icons.ui.Separator,
separator = icons.misc.Vbar,
group = icons.misc.Add,
},
window = {
border = "none",
position = "bottom",
margin = { 1, 0, 1, 0 },
padding = { 1, 1, 1, 1 },
winblend = 0,
},
})
require("which-key").register({
["<leader>"] = {
b = {
name = "Bufferline commands",
d = "buffer: Sort by directory",
e = "buffer: Sort by extension",
},
c = {
name = "Trouble commands",
a = { mode = { "n", "v" }, "lsp: Code action" },
d = "lsp: Show document diagnostics",
i = "lsp: Show incoming calls",
o = "lsp: Show outgoing calls",
w = "lsp: Show workspace diagnostics",
q = "lsp: Show quickfix list",
l = "lsp: Show loclist",
r = "lsp: Show lsp references",
},
d = {
name = "Dap commands",
b = "debug: Set breakpoint with condition",
B = "debug: List breakpoints",
c = "debug: Run to cursor",
d = "debug: Close debug panels",
i = "debug: Step into",
l = "debug: Do last run again",
o = "debug: Step out",
O = "debug: Open repl",
r = "debug: Run/Continue",
R = "debug: Start Lua debugger",
t = "debug: Terminate debug session",
v = "debug: Step over",
},
D = "git: Show diff",
f = {
name = "Telescope commands",
R = "find: Open previous picker",
p = "find: Project",
w = "find: Word",
r = "find: File by frecency",
k = "find: Keymaps",
s = "find: Word under cursor",
d = "find: Session",
e = "find: File by history",
c = "ui: Change colorscheme",
z = "edit: Change cwd using zoxide",
f = "find: File under cwd",
g = "find: File under current git directory",
i = "find: Open filetree browser",
b = "find: Buffer opened",
h = "find: Nvim highlights",
a = "find: Nvim automatic commands",
o = "find: Nvim options",
n = "edit: New file",
t = "find: Todo comments",
},
g = "git: Toggle lazygit",
G = "git: Toggle fugitive",
j = "jump: Goto line",
k = "jump: Goto line",
l = {
name = "LSP commands",
d = "lsp: Show line disgnostics",
i = "lsp: LSP Info",
r = "lsp: LSP Restart",
s = "lsp: LSP Start",
S = "lsp: LSP Stop",
},
n = {
name = "NvimTree commands",
f = "filetree: NvimTree find file",
r = "filetree: NvimTree refresh",
},
o = {
"jump: Goto one char",
o = "jump: Goto two chars",
},
p = {
{ mode = "x", "edit: Replacement using blackhole reg" },
name = "Package commands",
h = "package: Show",
s = "package: Sync",
i = "package: Install",
c = "package: Check",
d = "package: Debug",
l = "package: Log",
p = "package: Profile",
r = "package: Restore",
x = "package: Clean",
u = "package: Update",
},
r = {
{ mode = "n", "tool: Execute current line" },
{ mode = "v", "tool: Execute current selection" },
},
s = {
name = "Session commands",
s = "sesson: Save session",
l = "sesson: Load current",
d = "sesson: Delete session",
},
t = {
name = "Managing tab pages",
c = "tab: Close current tab",
j = "tab: Move to previous tab",
k = "tab: Move to next tab",
n = "tab: Create a new tab",
o = "tab: Only keep current tab",
},
u = "edit: Show undo history",
w = "jump: Goto word",
},
g = {
name = "LSP commands",
d = "lsp: Preview definition(s)",
D = "lsp: Goto definition",
ea = "edit: Align with delimiter",
h = "lsp: Show reference(s)",
r = "lsp: Rename in file range",
R = "lsp: Rename in project range",
s = "lsp: Signature help",
t = "lsp: Preview type definition(s)",
m = "lsp: Show implementation(s)",
p = {
name = "Git commands",
P = "git: Push",
p = "git: Pull",
},
["["] = "lsp: Prev diagnostic",
["]"] = "lsp: Next diagnostic",
},
-- Core mappings
["<S-Tab>"] = "edit: Toggle code fold",
["<C-s>"] = "edit: Save file",
Y = "edit: Yank text to EOL",
D = "edit: Delete text to EOL",
n = "edit: Next search result",
N = "edit: Prev search result",
J = {
{ mode = "n", "edit: Join next line" },
{ mode = "v", "edit: Move this line down" },
},
["<C-h>"] = {
{ mode = "n", "window: Focus shift left" },
{ mode = "c", "edit: Delete one char" },
},
["<A-o>"] = "window: Close current split",
["<C-l>"] = "window: Focus shift right",
["<C-j>"] = "window: Focus shift down",
["<C-k>"] = "window: Focus shift up",
["<A-[>"] = "window: Resize -5 vertically",
["<A-]>"] = "window: Resize +5 vertically",
["<A-;>"] = "window: Resize -2 horizontally",
["<A-'>"] = "window: Resize +2 horizontally",
["<Up>"] = "window: Resize +1 horizontally",
["<Down>"] = "window: Resize -1 horizontally",
["<Left>"] = "window: Resize +2 vertically",
["<Right>"] = "window: Resize -2 vertically",
["<C-q>"] = { mode = { "n", "i" }, "edit: Save file and quit" },
["<A-S-q>"] = "edit: Force quit",
["+"] = "edit: Increment under cursor",
["-"] = "edit: Decrement under cursor",
["<C-a>"] = {
{ mode = { "n", "x" }, "edit: Select all" },
{ mode = "c", "edit: Far left" },
{ mode = "i", "edit: Move cursor to line start" },
},
["<C-u>"] = { mode = "i", "edit: Delete previous block" },
["<C-b>"] = { mode = { "c", "i" }, "edit: Move cursor one char left" },
["<C-f>"] = { mode = "c", "edit: Right" },
["<C-e>"] = { mode = "c", "edit: Far right" },
["<C-d>"] = { mode = "c", "edit: Delete one char" },
["<C-t>"] = { mode = "c", "edit: Complete path of parent folder" },
K = {
{ mode = "n", "lsp: Show doc" },
{ mode = "v", "edit: Move this line up" },
},
["<"] = { mode = "v", "edit: Decrease indent (1L)" },
[">"] = { mode = "v", "edit: Increase indent (1L)" },
-- UI
["gb"] = "buffer: Pick current buffer",
["<A-q>"] = {
{ mode = "n", "buffer: Close" },
{ mode = "t", "terminal: Back to normal mode" },
},
["<A-p>"] = "buffer: Pin current buffer",
["<A-k>"] = "buffer: Cycle Next",
["<A-j>"] = "buffer: Cycle Prev",
["<A-S-k>"] = "buffer: Move current to next",
["<A-S-j>"] = "buffer: Move current to prev",
["<A-1>"] = "buffer: Goto buffer 1",
["<A-2>"] = "buffer: Goto buffer 2",
["<A-3>"] = "buffer: Goto buffer 3",
["<A-4>"] = "buffer: Goto buffer 4",
["<A-5>"] = "buffer: Goto buffer 5",
["<A-6>"] = "buffer: Goto buffer 6",
["<A-7>"] = "buffer: Goto buffer 7",
["<A-8>"] = "buffer: Goto buffer 8",
["<A-9>"] = "buffer: Goto buffer 9",
-- LSP
["<A-t>"] = "lsp: Toggle outline",
-- Terminals
["<A-d>"] = { mode = { "n", "i", "t" }, "terminal: Toggle float" },
["<A-\\>"] = { mode = { "n", "i", "t" }, "terminal: Toggle horizontal" },
["<A-S-\\>"] = { mode = { "n", "i", "t" }, "terminal: Toggle vertical" },
["<F5>"] = { mode = { "n", "i", "t" }, "terminal: Toggle vertical" },
-- Misc keymaps
["<F6>"] = "debug: Run/Continue",
["<F7>"] = "debug: Terminate debug session",
["<F8>"] = "debug: Toggle breakpoint",
["<F9>"] = "debug: Step into",
["<F10>"] = "debug: Step out",
["<F11>"] = "debug: Step over",
["<F12>"] = "tool: Markdown preview",
["<C-n>"] = "filetree: Toggle",
["<C-S-s>"] = "edit: Save file using sudo",
["<A-h>"] = "edit: Goto begin of pair",
["<A-l>"] = "edit: Goto end of pair",
["<leader>c"] = "edit: Toggle spell check",
["<leader><leader>D"] = "git: Close diff",
})
end