vim-which-key
vim-which-key copied to clipboard
Feature request: show subsequence mapping after prefix key
Currently, If have several mappings after prefix
, for example:
<leader>ab
<leader>ac
<leader>add
<leader>ade
If I press <leader>
, it will show
a -> prefix
,-
Can it show the following if I press <leader>
?
a-> bc[d]
,-
I use [d] to quote the keys that have subsequence mappings.
And, if I press <leader>a
, it will show
b -> for something c-> for something d -> de
,a-
And, if I press <leader>ad
, it will show
d -> for something e -> for something
,ad-
It will be more clear to know which key after the prefix.
If this already can be done, please kindly let me know how to configure it, I did not see this in any documentations. Thanks.
Actually I don't understand what your request is.
Can you read Traditional Chinese? If yes, I will use Chinese to explain again.
我的 <leader>
是,
,已經依照文件設定好了。但是有一些問題,舉例來說。
我的 .vimrc 中有以下 mappings。
<leader>ab
<leader>ac
<leader>add
<leader>ade
現在如果我按了 <leader>
, 他會顯示:
a -> prefix
,-
類似下圖:
我希望,當我按下 ,
的時候,我可以讓 vim-which-key 顯示成下面的樣子嗎?
a-> bc[d]
,-
因為 ,
後面還接著 b/c/d,因此我希望能讓他直接顯示出來 a -> bc[d]
,而非顯示 a -> prefix
,中括號 [d]
表示 d 後面還有按鍵可以按。
如果我按了 ,a
, vim-which-key 會顯示:
b -> for something c-> for something d -> de
,a-
如果我按了 ,ad
, vim-which-key 會顯示:
d -> for something e -> for something
,ad-
這樣我可以比較清楚,在 ,a
後還有哪些按鍵可以按,喚醒我的記憶,讓我直接接著打,不需要一層一層慢慢下去看。
我有查過文件,現在應該是不能這樣顯示。
謝謝。
这个想法挺好的,我有空看下。
这个想法挺好的,我有空看下。
謝謝!
要想显示 prefix 下层的按键可能不是那么简单,现在你可以用 name
属性进行优化,如果不存在 name
, 才会显示默认的 +prefix
, 参见 https://github.com/liuchengxu/space-vim/blob/d118bc7ff7/core/autoload/spacevim/map/leader.vim#L13 。
mmm ... 如果這樣,我變成每次有新的 mapping 加到 ,a
後我就必須要改一次 name
,來想想看。
不用每次,合理的做法是定义按键的就考虑 mnemonic, name
展示的这个 group 的主要功能,比如 b
就是 buffer 相关,t
就是 tab 相关,详情参见 https://www.spacemacs.org/doc/DOCUMENTATION.html#mnemonic 。