Skip to content

Instantly share code, notes, and snippets.

@tiann
Created February 1, 2016 08:00
Show Gist options
  • Save tiann/9068fd34f44337e8dcfb to your computer and use it in GitHub Desktop.
Save tiann/9068fd34f44337e8dcfb to your computer and use it in GitHub Desktop.
remapping the key when use markdown
<?xml version="1.0"?>
<root>
<inputsourcedef>
<name>MY_keylayout_zh_Hans</name>
<inputsourceid_prefix>com.apple.inputmethod.SCIM.ITABC</inputsourceid_prefix>
</inputsourcedef>
<item>
<name>markdown</name>
<identifier>private.quick_dotOfEnglish</identifier>
<inputsource_only>MY_keylayout_zh_Hans</inputsource_only>
<!--<uielementrole_only>AXTextArea, AXTextField</uielementrole_only>-->
<!-- ` -->
<autogen>__KeyToKey__
KeyCode::BACKQUOTE,
KeyCode::CAPSLOCK,
KeyCode::BACKQUOTE,
KeyCode::CAPSLOCK,
</autogen>
<!-- [ -->
<autogen>__KeyToKey__
KeyCode::BRACKET_LEFT,
KeyCode::CAPSLOCK,
KeyCode::BRACKET_LEFT,
KeyCode::CAPSLOCK,
</autogen>
<!-- ] -->
<autogen>__KeyToKey__
KeyCode::BRACKET_RIGHT,
KeyCode::CAPSLOCK,
KeyCode::BRACKET_RIGHT,
KeyCode::CAPSLOCK,
</autogen>
<!-- - -->
<autogen>__KeyToKey__
KeyCode::MINUS,
KeyCode::CAPSLOCK,
KeyCode::MINUS,
KeyCode::CAPSLOCK,
</autogen>
<!-- ! -->
<autogen>__KeyToKey__
KeyCode::KEY_1, ModifierFlag::SHIFT_R,
KeyCode::CAPSLOCK,
KeyCode::KEY_1, ModifierFlag::SHIFT_R,
KeyCode::CAPSLOCK,
</autogen>
<autogen>__KeyToKey__
KeyCode::KEY_1, ModifierFlag::SHIFT_L,
KeyCode::CAPSLOCK,
KeyCode::KEY_1, ModifierFlag::SHIFT_L,
KeyCode::CAPSLOCK,
</autogen>
<!-- # -->
<autogen>__KeyToKey__
KeyCode::KEY_3, ModifierFlag::SHIFT_R,
KeyCode::CAPSLOCK,
KeyCode::KEY_3, ModifierFlag::SHIFT_R,
KeyCode::CAPSLOCK,
</autogen>
<autogen>__KeyToKey__
KeyCode::KEY_3, ModifierFlag::SHIFT_L,
KeyCode::CAPSLOCK,
KeyCode::KEY_3, ModifierFlag::SHIFT_L,
KeyCode::CAPSLOCK,
</autogen>
<!-- * -->
<autogen>__KeyToKey__
KeyCode::KEY_8, ModifierFlag::SHIFT_R,
KeyCode::CAPSLOCK,
KeyCode::KEY_8, ModifierFlag::SHIFT_R,
KeyCode::CAPSLOCK,
</autogen>
<autogen>__KeyToKey__
KeyCode::KEY_8, ModifierFlag::SHIFT_L,
KeyCode::CAPSLOCK,
KeyCode::KEY_8, ModifierFlag::SHIFT_L,
KeyCode::CAPSLOCK,
</autogen>
<!-- ( -->
<autogen>__KeyToKey__
KeyCode::KEY_9, ModifierFlag::SHIFT_R,
KeyCode::CAPSLOCK,
KeyCode::KEY_9, ModifierFlag::SHIFT_R,
KeyCode::CAPSLOCK,
</autogen>
<autogen>__KeyToKey__
KeyCode::KEY_9, ModifierFlag::SHIFT_L,
KeyCode::CAPSLOCK,
KeyCode::KEY_9, ModifierFlag::SHIFT_L,
KeyCode::CAPSLOCK,
</autogen>
<!-- ) -->
<autogen>__KeyToKey__
KeyCode::KEY_0, ModifierFlag::SHIFT_R,
KeyCode::CAPSLOCK,
KeyCode::KEY_0, ModifierFlag::SHIFT_R,
KeyCode::CAPSLOCK,
</autogen>
<autogen>__KeyToKey__
KeyCode::KEY_0, ModifierFlag::SHIFT_L,
KeyCode::CAPSLOCK,
KeyCode::KEY_0, ModifierFlag::SHIFT_L,
KeyCode::CAPSLOCK,
</autogen>
</item>
</root>
!`:: Send {Asc 096} ;output `~
!+`:: Send % "{ASC 0" . Asc("~") . "}"
!-:: Send % "{ASC 0" . Asc("-") . "}" ; output -_
!+-:: Send % "{ASC 0" . Asc("_") . "}"
![:: Send % "{ASC 0" . Asc("[") . "}" ; output [{
!+[:: Send % "{ASC 0" . Asc("{") . "}"
!]:: Send % "{ASC 0" . Asc("]") . "}" ; output ]}
!+]:: Send % "{ASC 0" . Asc("}") . "}"
; ----------------------------------------------
!1:: Send % "{ASC 0" . Asc("!") . "}"
!3:: Send % "{ASC 0" . Asc("#") . "}"
!8:: Send % "{ASC 0" . Asc("*") . "}"
!9:: Send % "{ASC 0" . Asc("(") . "}"
!0:: Send % "{ASC 0" . Asc(")") . "}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment