Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: show subsequence mapping after prefix key #83

Open
markwu opened this issue Dec 25, 2019 · 8 comments
Open

Feature request: show subsequence mapping after prefix key #83

markwu opened this issue Dec 25, 2019 · 8 comments

Comments

@markwu
Copy link

markwu commented Dec 25, 2019

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.

@liuchengxu
Copy link
Owner

Actually I don't understand what your request is.

@markwu
Copy link
Author

markwu commented Dec 25, 2019

Can you read Traditional Chinese? If yes, I will use Chinese to explain again.

@markwu
Copy link
Author

markwu commented Dec 25, 2019

我的 <leader>,,已經依照文件設定好了。但是有一些問題,舉例來說。

我的 .vimrc 中有以下 mappings。

<leader>ab
<leader>ac
<leader>add
<leader>ade

現在如果我按了 <leader>, 他會顯示:

a -> prefix

,-

類似下圖:

image

我希望,當我按下 , 的時候,我可以讓 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 後還有哪些按鍵可以按,喚醒我的記憶,讓我直接接著打,不需要一層一層慢慢下去看。

我有查過文件,現在應該是不能這樣顯示。

謝謝。

@liuchengxu
Copy link
Owner

这个想法挺好的,我有空看下。

@markwu
Copy link
Author

markwu commented Dec 25, 2019

这个想法挺好的,我有空看下。

謝謝!

@liuchengxu
Copy link
Owner

要想显示 prefix 下层的按键可能不是那么简单,现在你可以用 name 属性进行优化,如果不存在 name, 才会显示默认的 +prefix, 参见 https://github.com/liuchengxu/space-vim/blob/d118bc7ff7/core/autoload/spacevim/map/leader.vim#L13

@markwu
Copy link
Author

markwu commented Dec 26, 2019

mmm ... 如果這樣,我變成每次有新的 mapping 加到 ,a 後我就必須要改一次 name,來想想看。

@liuchengxu
Copy link
Owner

不用每次,合理的做法是定义按键的就考虑 mnemonic, name 展示的这个 group 的主要功能,比如 b 就是 buffer 相关,t 就是 tab 相关,详情参见 https://www.spacemacs.org/doc/DOCUMENTATION.html#mnemonic

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants