forked from askfiy/nvim
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnv_which-key.lua
More file actions
89 lines (77 loc) · 2.21 KB
/
nv_which-key.lua
File metadata and controls
89 lines (77 loc) · 2.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
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
-- https://github.com/folke/which-key.nvim
local M = {
safe_requires = {
{ "which-key", "wk" },
},
}
function M.before() end
function M.load()
-- FIX: https://github.com/folke/which-key.nvim/issues/273
local show = M.wk.show
M.wk.show = function(keys, opts)
if vim.bo.filetype == "TelescopePrompt" then
local map = "<c-r>"
local key = vim.api.nvim_replace_termcodes(map, true, false, true)
vim.api.nvim_feedkeys(key, "i", true)
end
show(keys, opts)
end
M.wk.setup({
plugins = {
spelling = {
enabled = true,
suggestions = 20,
},
},
icons = {
breadcrumb = " ",
separator = " ",
group = " ",
},
})
end
function M.after()
-- global leader
M.wk.register({
b = { name = "Buffers" },
c = { name = "Code" },
d = { name = "Debug" },
f = { name = "Find" },
g = { name = "Git" },
r = { name = "Replace", w = "Replace Word To ..." },
s = { name = "Session" },
u = { name = "Upload" },
t = {
name = "Terminal | Translate",
c = "Translate English to Chinese",
e = "Translate Chinese to English",
},
}, { prefix = "<leader>", mode = "n" })
-- comment
M.wk.register({
c = {
name = "Comment",
c = "Toggle line comment",
b = "Toggle block comment",
a = "Insert line comment to line end",
j = "Insert line comment to next line",
k = "Insert line comment to previous line",
},
}, { prefix = "g", mode = "n" })
M.wk.register({
c = "Switch the specified line to a line comment",
b = "Switch the specified line to a block comment",
}, { prefix = "g", mode = "v" })
-- surround
M.wk.register({
q = "Switch Surround",
s = "Change Surround",
}, { prefix = "c", mode = "n" })
M.wk.register({
s = "Delete Surround",
}, { prefix = "d", mode = "n" })
M.wk.register({
s = "Add Surround",
}, { prefix = "y", mode = "n" })
end
return M