Closed steve-lorimer closed 5 days ago
What I'm hoping for is to replicate the 1..9
in the below example image, which is taken from the spacemacs config in emacs
You can hide some entries using which_key_ignore
key, for example:
...
['2'] = { '<cmd>echo 2<CR>', 'which_key_ignore'},
...
Still I don't know how to display something that looks like 1..9
or so.
You can also get some different approach, move 1..9
to a subgroup to reduce clutter:
...
w = {
name = 'Go to window',
x = '1..10', -- group has to contain some visible entry
['1'] = { '<cmd>echo 1<CR>', 'which_key_ignore'},
['2'] = { '<cmd>echo 2<CR>', 'which_key_ignore'},
['3'] = { '<cmd>echo 3<CR>', 'which_key_ignore'},
['4'] = { '<cmd>echo 4<CR>', 'which_key_ignore'},
['5'] = { '<cmd>echo 5<CR>', 'which_key_ignore'},
['6'] = { '<cmd>echo 6<CR>', 'which_key_ignore'},
['7'] = { '<cmd>echo 7<CR>', 'which_key_ignore'},
['8'] = { '<cmd>echo 8<CR>', 'which_key_ignore'},
['9'] = { '<cmd>echo 9<CR>', 'which_key_ignore'},
['10'] = { '<cmd>echo 10<CR>', 'which_key_ignore'},
},
...
Or jump one by one (repeatable):
...
w = {
name = 'Window',
j = { '<C-w>j<cmd>WhichKey <LT>Leader>w<CR>', 'Go down' },
k = { '<C-w>k<cmd>WhichKey <LT>Leader>w<CR>', 'Go up' },
h = { '<C-w>h<cmd>WhichKey <LT>Leader>w<CR>', 'Go left' },
l = { '<C-w>l<cmd>WhichKey <LT>Leader>w<CR>', 'Go right' },
d = { '<C-w>c<cmd>WhichKey <LT>Leader>w<CR>', 'Delete' },
s = { '<C-w>s<cmd>WhichKey <LT>Leader>w<CR>', 'Split horizontal' },
v = { '<C-w>v<cmd>WhichKey <LT>Leader>w<CR>', 'Split vertical' },
},
...
Let me know if there is a better way.
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days.
Is it possible to configure multiple keybindings under a single which-key label?
For example, I have the following similar bindings:
<leader>1
bound to"<cmd>1wincmd w<CR>"
<leader>2
bound to"<cmd>2wincmd w<CR>"
<leader>3
bound to"<cmd>3wincmd w<CR>"
...<leader>9
bound to"<cmd>9wincmd w<CR>"
If I just add all the above to
which-key
I end up with the popup completely swamped with a multitude of similar key mappingsI would instead like to "collapse" them all into a single menu item
I would like to do something like:
However, this seems to fail somewhere - the keybinding isn't added to
which-key
.Is there a way to have
which-key
display something like1..9 -> Select window 1..9
?