Skip to content

Instantly share code, notes, and snippets.

@ha4gu
Last active April 8, 2019 12:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ha4gu/bcea8f4e5d8fa8064d5b949b5ce50343 to your computer and use it in GitHub Desktop.
Save ha4gu/bcea8f4e5d8fa8064d5b949b5ce50343 to your computer and use it in GitHub Desktop.
for macOS initial setup
#!/bin/bash
mkdir -p $HOME/.config/karabiner/assets/complex_modifications
cd $HOME/.config/karabiner/assets/complex_modifications/.
curl -OLs https://gist.githubusercontent.com/ha4gu/bcea8f4e5d8fa8064d5b949b5ce50343/raw/swaptab.json
curl -OLs https://gist.githubusercontent.com/ha4gu/bcea8f4e5d8fa8064d5b949b5ce50343/raw/terminal.json
curl -OLs https://gist.githubusercontent.com/ha4gu/bcea8f4e5d8fa8064d5b949b5ce50343/raw/other.json
{
"title": "その他",
"rules": [
{
"description": "Shift+SpaceをF13に割り当てる(合わせてmacOS側でF13を入力ソース切り替えに割り当てること)",
"manipulators": [
{
"type": "basic",
"from": { "key_code": "spacebar", "modifiers": { "mandatory": [ "shift" ] } },
"to": [ { "key_code": "f13" } ]
}
]
},
{
"description": "Option+LをCtrl+Command+Q(画面をロック)に割り当てる",
"manipulators": [
{
"type": "basic",
"from": { "key_code": "l", "modifiers": { "mandatory": [ "option" ] } },
"to": [ { "key_code": "q", "modifiers": [ "control", "command" ] } ]
}
]
}
]
}
{
"title": "Swap Command+Tab and Control+Tab",
"rules": [
{
"description": "Change Command+Tab to Control+Tab",
"manipulators": [
{
"from": {
"key_code": "tab",
"modifiers": {
"mandatory": [
"command"
],
"optional": [
"any"
]
}
},
"to": [
{
"key_code": "tab",
"modifiers": [
"control"
]
}
],
"type": "basic"
}
]
},
{
"description": "Change Control+Tab to Command+Tab",
"manipulators": [
{
"from": {
"key_code": "tab",
"modifiers": {
"mandatory": [
"control"
],
"optional": [
"any"
]
}
},
"to": [
{
"key_code": "tab",
"modifiers": [
"command"
]
}
],
"type": "basic"
}
]
}
]
}
{
"title": "ターミナルやiTerm2でのみ有効にしたい設定群",
"rules": [
{
"description": "Terminal.appやiTerm2で、Command-aをControl-aに変換する(tmuxプリフィックス)",
"manipulators": [
{
"type": "basic",
"from": { "key_code": "a", "modifiers": { "mandatory": [ "command" ] } },
"to": [ { "key_code": "a", "modifiers": [ "control" ] } ],
"conditions": [ { "type": "frontmost_application_if", "bundle_identifiers": [ "^com\\.apple\\.Terminal$", "^com\\.googlecode\\.iterm2$" ] } ]
}
]
},
{
"description": "Terminal.appやiTerm2で、Command-bをControl-bに変換する(ページ戻し)",
"manipulators": [
{
"type": "basic",
"from": { "key_code": "b", "modifiers": { "mandatory": [ "command" ] } },
"to": [ { "key_code": "b", "modifiers": [ "control" ] } ],
"conditions": [ { "type": "frontmost_application_if", "bundle_identifiers": [ "^com\\.apple\\.Terminal$", "^com\\.googlecode\\.iterm2$" ] } ]
}
]
},
{
"description": "Terminal.appやiTerm2で、Command-cをControl-cに変換する(キャンセル)",
"manipulators": [
{
"type": "basic",
"from": { "key_code": "c", "modifiers": { "mandatory": [ "command" ] } },
"to": [ { "key_code": "c", "modifiers": [ "control" ] } ],
"conditions": [ { "type": "frontmost_application_if", "bundle_identifiers": [ "^com\\.apple\\.Terminal$", "^com\\.googlecode\\.iterm2$" ] } ]
}
]
},
{
"description": "Terminal.appやiTerm2で、Command-dをControl-dに変換する(ログアウト)",
"manipulators": [
{
"type": "basic",
"from": { "key_code": "d", "modifiers": { "mandatory": [ "command" ] } },
"to": [ { "key_code": "d", "modifiers": [ "control" ] } ],
"conditions": [ { "type": "frontmost_application_if", "bundle_identifiers": [ "^com\\.apple\\.Terminal$", "^com\\.googlecode\\.iterm2$" ] } ]
}
]
},
{
"description": "Terminal.appやiTerm2で、Command-fをControl-fに変換する(ページ送り)",
"manipulators": [
{
"type": "basic",
"from": { "key_code": "f", "modifiers": { "mandatory": [ "command" ] } },
"to": [ { "key_code": "f", "modifiers": [ "control" ] } ],
"conditions": [ { "type": "frontmost_application_if", "bundle_identifiers": [ "^com\\.apple\\.Terminal$", "^com\\.googlecode\\.iterm2$" ] } ]
}
]
},
{
"description": "Terminal.appやiTerm2で、Command-lをControl-lに変換する(画面クリア)",
"manipulators": [
{
"type": "basic",
"from": { "key_code": "l", "modifiers": { "mandatory": [ "command" ] } },
"to": [ { "key_code": "l", "modifiers": [ "control" ] } ],
"conditions": [ { "type": "frontmost_application_if", "bundle_identifiers": [ "^com\\.apple\\.Terminal$", "^com\\.googlecode\\.iterm2$" ] } ]
}
]
},
{
"description": "Terminal.appやiTerm2で、Command-nをControl-nに変換する(履歴進む)",
"manipulators": [
{
"type": "basic",
"from": { "key_code": "n", "modifiers": { "mandatory": [ "command" ] } },
"to": [ { "key_code": "n", "modifiers": [ "control" ] } ],
"conditions": [ { "type": "frontmost_application_if", "bundle_identifiers": [ "^com\\.apple\\.Terminal$", "^com\\.googlecode\\.iterm2$" ] } ]
}
]
},
{
"description": "Terminal.appやiTerm2で、Command-pをControl-pに変換する(履歴戻る)",
"manipulators": [
{
"type": "basic",
"from": { "key_code": "p", "modifiers": { "mandatory": [ "command" ] } },
"to": [ { "key_code": "p", "modifiers": [ "control" ] } ],
"conditions": [ { "type": "frontmost_application_if", "bundle_identifiers": [ "^com\\.apple\\.Terminal$", "^com\\.googlecode\\.iterm2$" ] } ]
}
]
},
{
"description": "Terminal.appやiTerm2で、Command-rをControl-rに変換する(bash履歴)",
"manipulators": [
{
"type": "basic",
"from": { "key_code": "r", "modifiers": { "mandatory": [ "command" ] } },
"to": [ { "key_code": "r", "modifiers": [ "control" ] } ],
"conditions": [ { "type": "frontmost_application_if", "bundle_identifiers": [ "^com\\.apple\\.Terminal$", "^com\\.googlecode\\.iterm2$" ] } ]
}
]
},
{
"description": "Terminal.appやiTerm2で、Command-zをControl-zに変換する(中断)",
"manipulators": [
{
"type": "basic",
"from": { "key_code": "z", "modifiers": { "mandatory": [ "command" ] } },
"to": [ { "key_code": "z", "modifiers": [ "control" ] } ],
"conditions": [ { "type": "frontmost_application_if", "bundle_identifiers": [ "^com\\.apple\\.Terminal$", "^com\\.googlecode\\.iterm2$" ] } ]
}
]
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment