karabiner

Karabiner is a great tool to modify our keyboard, which can define different key remap in various applications.

1 Seil and karabiner

We have to download seil to modify Caps lock in yosemite.

2 Private.xml

Define all keymaps in private.xml as we wish. The official tutorial and sample xml are greate help to write our private.xml.

We modify our keyboard just as this said.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<?xml version="1.0"?>
<root>
<item>
<name>Command_R to Control_L (only in emacs, terminal)</name>
<identifier>private.right_command_to_left_control</identifier>
<only>EMACS, TERMINAL</only>
<autogen>__KeyToKey__ KeyCode::COMMAND_R, KeyCode::CONTROL_L</autogen>
</item>

<item>
<name>Swap Command_L and Option_L (only in emacs)</name>
<identifier>private.swap_left_command_and_left_option</identifier>
<only>EMACS</only>
<autogen>__KeyToKey__ KeyCode::COMMAND_L, KeyCode::OPTION_L</autogen>
<autogen>__KeyToKey__ KeyCode::OPTION_L, KeyCode::COMMAND_L</autogen>
<appendix>Keep Command_L+Tab</appendix>
<autogen>__KeyToKey__ KeyCode::TAB,ModifierFlag::OPTION_L, KeyCode::TAB,ModifierFlag::COMMAND_L</autogen>
<autogen>__KeyToKey__ KeyCode::TAB,ModifierFlag::COMMAND_L, KeyCode::TAB,ModifierFlag::OPTION_L</autogen>
</item>


<item>
<name>Application Key to Option_L+Space</name>
<identifier>private.app_key_to_left_option_and_space</identifier>
<autogen>__KeyToKey__ KeyCode::PC_APPLICATION, KeyCode::SPACE,ModifierFlag::OPTION_L</autogen>
</item>

<item>
<name>Swap backtick ` and tilde ~</name>
<identifier>private.swap_backtick_and_tilde</identifier>
<autogen>__KeyToKey__ KeyCode::BACKQUOTE,ModifierFlag::SHIFT_L, KeyCode::BACKQUOTE</autogen>
<autogen>__KeyToKey__ KeyCode::BACKQUOTE,ModifierFlag::SHIFT_R, KeyCode::BACKQUOTE</autogen>
<autogen>__KeyToKey__ KeyCode::BACKQUOTE, KeyCode::BACKQUOTE,ModifierFlag::SHIFT_L</autogen>
</item>

</root>