やりたいこと
英数 + キーの組み合わせでカーソル移動させる。
運動神経がなさすぎるので下記のような設定にしてみました。
英数 + j -> 左
英数 + l -> 上
英数 + i -> 右
英数 + k -> 下
英数 + h -> 単語の先頭に移動
英数 + g -> 行の先頭に移動
英数 + ; -> 単語の末尾に移動
英数 + : -> 行の末尾に移動
英数 + u -> Enter
英数 + o -> BackSpace
設定方法
設定ファイル
~/.config/karabiner/assets/complex_modifications/karabiner_myoption.jsonComplex modificationsの画面のAdd rulesに出るので選択します。
画面を閉じると下記に設定が追記されます。
~/.config/karabiner/karabiner.json
{
// グループ名です。何でも良い。
"title": "My Options",
"rules": [
{
// 名前です。何でも良い。
"description": "Change Eisu + JKLI to arrow keys",
"manipulators": [
// 変数を用意して、英数キーを押してるかどうか判別する
{
"from": {
"key_code": "japanese_eisuu",
"modifiers": {
// caps_lockを押してても有効にする
"optional": [
"caps_lock"
]
}
},
// キーを押したらeisuuに1を入れる
"to": [
{
"set_variable": {
"name": "eisuu",
"value": 1
}
}
],
// キーを離したらeisuuに0を入れる
"to_after_key_up": [
{
"set_variable": {
"name": "eisuu",
"value": 0
}
}
],
// 通常は元の動作
"to_if_alone": [
{
"key_code": "japanese_eisuu"
}
],
"type": "basic"
},
{
// 英数キーを押してる場合のみ(eisuuに1が入ってる場合のみ)
"conditions": [
{
"name": "eisuu",
"type": "variable_if",
"value": 1
}
],
// 変換元
"from": {
"key_code": "j",
"modifiers": {
// 他のキーとの組み合わせも有効にする
"optional": [
"any"
]
}
},
// 変換先
"to": [
{
"key_code": "left_arrow"
}
],
"type": "basic"
},
{
"conditions": [
{
"name": "eisuu",
"type": "variable_if",
"value": 1
}
],
"from": {
"key_code": "k",
"modifiers": {
"optional": [
"any"
]
}
},
"to": [
{
"key_code": "down_arrow"
}
],
"type": "basic"
},
{
"conditions": [
{
"name": "eisuu",
"type": "variable_if",
"value": 1
}
],
"from": {
"key_code": "l",
"modifiers": {
"optional": [
"any"
]
}
},
"to": [
{
"key_code": "right_arrow"
}
],
"type": "basic"
},
{
"conditions": [
{
"name": "eisuu",
"type": "variable_if",
"value": 1
}
],
"from": {
"key_code": "i",
"modifiers": {
"optional": [
"any"
]
}
},
"to": [
{
"key_code": "up_arrow"
}
],
"type": "basic"
},
{
"conditions": [
{
"name": "eisuu",
"type": "variable_if",
"value": 1
}
],
"from": {
"key_code": "h",
"modifiers": {
"optional": [
"any"
]
}
},
"to": [
// optionキー + 左矢印
{
"key_code": "left_arrow",
"modifiers": [
"left_option"
]
}
],
"type": "basic"
},
{
"conditions": [
{
"name": "eisuu",
"type": "variable_if",
"value": 1
}
],
"from": {
"key_code": "g",
"modifiers": {
"optional": [
"any"
]
}
},
"to": [
{
"key_code": "a",
"modifiers": [
"left_control"
]
}
],
"type": "basic"
},
{
"conditions": [
{
"name": "eisuu",
"type": "variable_if",
"value": 1
}
],
"from": {
"key_code": "semicolon",
"modifiers": {
"optional": [
"any"
]
}
},
"to": [
{
"key_code": "right_arrow",
"modifiers": [
"left_option"
]
}
],
"type": "basic"
},
{
"conditions": [
{
"name": "eisuu",
"type": "variable_if",
"value": 1
}
],
"from": {
"key_code": "quote",
"modifiers": {
"optional": [
"any"
]
}
},
"to": [
{
"key_code": "e",
"modifiers": [
"left_control"
]
}
],
"type": "basic"
},
{
"conditions": [
{
"name": "eisuu",
"type": "variable_if",
"value": 1
}
],
"from": {
"key_code": "u",
"modifiers": {
"optional": [
"any"
]
}
},
"to": [
{
"key_code": "return_or_enter"
}
],
"type": "basic"
},
{
"conditions": [
{
"name": "eisuu",
"type": "variable_if",
"value": 1
}
],
"from": {
"key_code": "o",
"modifiers": {
"optional": [
"any"
]
}
},
"to": [
{
"key_code": "delete_or_backspace"
}
],
"type": "basic"
}
]
}
]
}
Windows用キーボードをMacで使う
接続したら勝手に有効になってくれるので便利。