Skip to content

Commit 7e11e8a

Browse files
committed
Merge 'upstream' cleanup: refactor which-key configuration
2 parents 7d83a27 + 24d368f commit 7e11e8a

1 file changed

Lines changed: 47 additions & 49 deletions

File tree

lua/kickstart/plugins/which-key.lua

Lines changed: 47 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -17,57 +17,55 @@ return {
1717
{ -- Useful plugin to show you pending keybinds.
1818
'folke/which-key.nvim',
1919
event = 'VimEnter', -- Sets the loading event to 'VimEnter'
20-
config = function() -- This is the function that runs, AFTER loading
21-
require('which-key').setup {
22-
icons = {
23-
-- set icon mappings to true if you have a Nerd Font
24-
mappings = vim.g.have_nerd_font,
25-
-- If you are using a Nerd Font: set icons.keys to an empty table which will use the
26-
-- default whick-key.nvim defined Nerd Font icons, otherwise define a string table
27-
keys = vim.g.have_nerd_font and {} or {
28-
Up = '<Up> ',
29-
Down = '<Down> ',
30-
Left = '<Left> ',
31-
Right = '<Right> ',
32-
C = '<C-…> ',
33-
M = '<M-…> ',
34-
D = '<D-…> ',
35-
S = '<S-…> ',
36-
CR = '<CR> ',
37-
Esc = '<Esc> ',
38-
ScrollWheelDown = '<ScrollWheelDown> ',
39-
ScrollWheelUp = '<ScrollWheelUp> ',
40-
NL = '<NL> ',
41-
BS = '<BS> ',
42-
Space = '<Space> ',
43-
Tab = '<Tab> ',
44-
F1 = '<F1>',
45-
F2 = '<F2>',
46-
F3 = '<F3>',
47-
F4 = '<F4>',
48-
F5 = '<F5>',
49-
F6 = '<F6>',
50-
F7 = '<F7>',
51-
F8 = '<F8>',
52-
F9 = '<F9>',
53-
F10 = '<F10>',
54-
F11 = '<F11>',
55-
F12 = '<F12>',
56-
},
20+
opts = {
21+
icons = {
22+
-- set icon mappings to true if you have a Nerd Font
23+
mappings = vim.g.have_nerd_font,
24+
-- If you are using a Nerd Font: set icons.keys to an empty table which will use the
25+
-- default whick-key.nvim defined Nerd Font icons, otherwise define a string table
26+
keys = vim.g.have_nerd_font and {} or {
27+
Up = '<Up> ',
28+
Down = '<Down> ',
29+
Left = '<Left> ',
30+
Right = '<Right> ',
31+
C = '<C-…> ',
32+
M = '<M-…> ',
33+
D = '<D-…> ',
34+
S = '<S-…> ',
35+
CR = '<CR> ',
36+
Esc = '<Esc> ',
37+
ScrollWheelDown = '<ScrollWheelDown> ',
38+
ScrollWheelUp = '<ScrollWheelUp> ',
39+
NL = '<NL> ',
40+
BS = '<BS> ',
41+
Space = '<Space> ',
42+
Tab = '<Tab> ',
43+
F1 = '<F1>',
44+
F2 = '<F2>',
45+
F3 = '<F3>',
46+
F4 = '<F4>',
47+
F5 = '<F5>',
48+
F6 = '<F6>',
49+
F7 = '<F7>',
50+
F8 = '<F8>',
51+
F9 = '<F9>',
52+
F10 = '<F10>',
53+
F11 = '<F11>',
54+
F12 = '<F12>',
5755
},
58-
}
5956

60-
-- Document existing key chains
61-
require('which-key').add {
62-
{ '<leader>c', group = '[C]ode', mode = { 'n', 'x' } },
63-
{ '<leader>d', group = '[D]ocument' },
64-
{ '<leader>r', group = '[R]ename' },
65-
{ '<leader>s', group = '[S]earch' },
66-
{ '<leader>w', group = '[W]orkspace' },
67-
{ '<leader>t', group = '[T]oggle' },
68-
{ '<leader>h', group = 'Git [H]unk', mode = { 'n', 'v' } },
69-
}
70-
end,
57+
-- Document existing key chains
58+
spec = {
59+
{ '<leader>c', group = '[C]ode', mode = { 'n', 'x' } },
60+
{ '<leader>d', group = '[D]ocument' },
61+
{ '<leader>r', group = '[R]ename' },
62+
{ '<leader>s', group = '[S]earch' },
63+
{ '<leader>w', group = '[W]orkspace' },
64+
{ '<leader>t', group = '[T]oggle' },
65+
{ '<leader>h', group = 'Git [H]unk', mode = { 'n', 'v' } },
66+
},
67+
},
68+
},
7169
},
7270
}
7371
-- vim: ts=2 sts=2 sw=2 et

0 commit comments

Comments
 (0)