xremap 拯救我的小拇指
目录
注意
本文最后更新于 2024-10-20,文中内容可能已过时。
我常用的编辑器是 vim
,最近开始入坑 Emacs
,觉得使用 M-x
导致小拇指极其难受。于是在谷歌搜索一番后,发现可以使用 xremap
重映射功能键,把 Ctrl
和 Alt
映射到更加方便的键盘位。
下载 xremap
可以到网站下载,选择 x11
。解压后即可看到 xremap
可执行文件。
配置
可以编辑 ~/.config/xremap.yaml
,具体的键位名称可以参考:keys
注意
For KEY_XXX and KEY_YYY, use these names. You can skip KEY_ and the name is case-insensitive. So KEY_CAPSLOCK, CAPSLOCK, and CapsLock are the same thing
modmap
注意
modmap is for key-to-key remapping like xmodmap. Note that remapping a key to a modifier key, e.g. CapsLock to Control_L, is supported only in modmap since keymap handles modifier keys differently.
-
modmap
是一一对应的关系,不像keymap
可以使用组合方式。比如,我把CapsLock
当成Esc
使用。 -
同时,我们还可以通过定义一个触发规则,把一个键位对应到多个事件,这个是通过定义
held
和alone
组合来实现。比如我这里把Ctrl_L
映射为两个行为- 如果是单独触发,在时间
alone_timeout_millis
内没有触发其他的按键,则对应Esc
- 如果是组合触发,比如我使用
Ctrl-k
来切换tmux
window
- 如果是单独触发,在时间
注意
If you specify a map containing held and alone, you can use the key for two purposes. The key is considered alone if it’s pressed and released within alone_timeout_millis (default: 1000) before any other key is pressed. Otherwise it’s considered held.
keymap
keymap
可以实现组合键。
|
|
这里需要区分 modmap
与 keymap
modmap
is for key-to-key remapping like xmodmap. Note that remapping a key to a modifier key, e.g.CapsLock
toControl_L
, is supported only inmodmap
sincekeymap
handles modifier keys differently.keymap
is for remapping a sequence of key combinations to another sequence of key combinations or other actions.
运行
使用 root
权限运行即可
|
|
如果不使用 root
执行,则需要设置
|
|
ref

