用Mac OS X的时候,外接的键盘上面的小键盘(Key Pad)在一些程序上会失灵,比如iTerm2就会无法使用小键盘上面的数字回车加号减号星号斜杠。今天老蔡终于找到了一款可以解决这个问题的软件:Karabiner。
Karabiner是一款能帮Mac OS X改键的软件,键盘鼠标的键都可以改。
映射小键盘上面的星号、加号比较不同,需要把键位映射成组合键,其他的都是可以直接映射的。
至于如何导入配置,可以参考How to add your own settings 配置如下:
-
Change KeyPad 0 to Num 0
private.change\_keypad0\_to_num0
\_\_KeyToKey\_\_ KeyCode::KEYPAD\_0, KeyCode::KEY\_0
-
Change KeyPad 1 to Num 1
private.change\_keypad1\_to_num1
\_\_KeyToKey\_\_ KeyCode::KEYPAD\_1, KeyCode::KEY\_1
-
Change KeyPad 2 to Num 2
private.change\_keypad2\_to_num2
\_\_KeyToKey\_\_ KeyCode::KEYPAD\_2, KeyCode::KEY\_2
-
Change KeyPad 3 to Num 3
private.change\_keypad3\_to_num3
\_\_KeyToKey\_\_ KeyCode::KEYPAD\_3, KeyCode::KEY\_3
-
Change KeyPad 4 to Num 4
private.change\_keypad4\_to_num4
\_\_KeyToKey\_\_ KeyCode::KEYPAD\_4, KeyCode::KEY\_4
-
Change KeyPad 5 to Num 5
private.change\_keypad5\_to_num5
\_\_KeyToKey\_\_ KeyCode::KEYPAD\_5, KeyCode::KEY\_5
-
Change KeyPad 6 to Num 6
private.change\_keypad6\_to_num6
\_\_KeyToKey\_\_ KeyCode::KEYPAD\_6, KeyCode::KEY\_6
-
Change KeyPad 7 to Num 7
private.change\_keypad7\_to_num7
\_\_KeyToKey\_\_ KeyCode::KEYPAD\_7, KeyCode::KEY\_7
-
Change KeyPad 8 to Num 8
private.change\_keypad8\_to_num8
\_\_KeyToKey\_\_ KeyCode::KEYPAD\_8, KeyCode::KEY\_8
-
Change KeyPad 9 to Num 9
private.change\_keypad9\_to_num9
\_\_KeyToKey\_\_ KeyCode::KEYPAD\_9, KeyCode::KEY\_9
-
Change KeyPad / to /
private.change\_keypadslash\_to\_shift\_slash
\_\_KeyToKey\_\_ KeyCode::KEYPAD_SLASH, KeyCode::SLASH
-
Change KeyPad * to shift+8
private.change\_keypadasterisk\_to\_shift\_shift_8
\_\_KeyToKey\_\_ KeyCode::KEYPAD\_MULTIPLY, KeyCode::KEY\_8, ModifierFlag::SHIFT_L
-
Change KeyPad - to -
private.change\_keypadminus\_to\_shift\_minus
\_\_KeyToKey\_\_ KeyCode::KEYPAD_MINUS, KeyCode::MINUS
-
Change KeyPad + to shift+=
private.change\_keypadplus\_to\_shift\_plus
\_\_KeyToKey\_\_ KeyCode::KEYPAD\_PLUS, KeyCode::EQUAL, ModifierFlag::SHIFT\_L
-
Change KeyPad Enter to Return
private.change\_keypad\_enter\_to\_return
\_\_KeyToKey\_\_ KeyCode::ENTER, KeyCode::RETURN
-
Change KeyPad Dot to Dot
private.change\_keypad\_dot\_to\_dot
\_\_KeyToKey\_\_ KeyCode::KEYPAD_DOT, KeyCode::DOT
本文是受到了oschina上的@yoyoso的一篇不完整的映射方案启发后探索和调试数个小时整理出来的。感谢@yoyoso同学。
使用发生错误之类的欢迎留言。
另外如果有兴趣,折腾完了键盘,可以继续折腾一下鼠标:Karabiner改鼠标上的快捷键