Replies: 2 comments 2 replies
-
After further improvement, when entering motion state, the major-mode map will automatically have its parent set to the normal state. Another advantage is, for example in help-mode, the characters "," and "." are not bound by default. By enabling this feature, the functions for "," and "." remain available in help-mode under moeow. 进一步做了改进后,当进入 motion state 后 自动将 major-mode map 的parent 设置为 normal state 你觉得这个功能怎么样,有没有可能合到meow中。 |
Beta Was this translation helpful? Give feedback.
-
After some thinking, I don't think we need this in meow. First of all, this could break some configurations which already uses the parent map. Second, there's no obvious advantage to do this setup in meow than do it without meow. I can always use this tricky to achieve, and it's already straightforward. If I want I could have a keymap which supports HJKL movements, and use it as the parent map at anywhere I want. |
Beta Was this translation helpful? Give feedback.
-
Regarding motion state, I have some thoughts.
For example, in help-mode, by default it belongs to motion state. However, I want to use some default normal state keybindings in help-mode instead of those in help-mode-map. For instance, I would like to bind "r" in help-mode-map to
#'help-go-forward
.I considered executing the following code to achieve this:
However, the actual effect is that "r" becomes undefined.
Therefore, I want to understand if it is possible to set the priority of the following keymaps in motion state: motion-state-map > help-mode-map > normal-state-map. This way, if I want the keys from normal-state-map to be effective, I only need to unbind them in the major-mode, while the latest priority remains in motion-state-map, which is usually empty.
Thus, my idea is to let the major-mode of a mode in motion state automatically inherit from
meow-normal-state-keymap
. This can be done using the following macro, and meow just needs to callmeow-set-keymap-parent
at the appropriate time:After loading help mode, I can execute the following code:
Users would only need to do the following to achieve the desired effect:
关于 motion state,我有一些想法。
以 help-mode 为例,默认情况下 help-mode 属于 motion state。然而,我想在 help-mode 下使用某些默认的 normal state 按键绑定,而不是 help-mode-map 中的绑定。例如,我希望将 help-mode-map 中的 "r" 绑定为 #'help-go-forward。
我考虑执行以下代码来实现:
然而,实际效果是 "r" 变成了 undefined。
由此,我想要了解是否可以在 motion state 下,设置以下几个 keymap 的优先级:motion-state-map > help-mode-map > normal-state-map。这样,如果想让 normal-state-map 的键生效,只需在 major-mode 中取消绑定即可,而最新的优先级放在 motion-state-map 内,通常 motion-state-map 是空的。
因此,我的想法是让处于 motion state 的 mode 其 major-mode-map 自动继承自 meow-normal-state-keymap。可以通过以下宏来实现,meow 只需在合适的时机调用 meow-set-keymap-parent:
在 help mode 加载后执行以下代码:
用户只需要如下做就能实现想要的效果。
Beta Was this translation helpful? Give feedback.
All reactions