Mac初期設定メモ

## 環境
- macOS Catalina
- US keyboard

## macOS設定
**キーボードショートカット**

|アプリケーション|機能|トリガー|
|---|---|---|
|Mission Control|-|F3|
|Mission Control|デスクトップを表示|F4|
|Mission Control|デスクトップ1へ切り替え|⌃1|
|Mission Control|デスクトップ2へ切り替え|⌃2|
|キーボード|次のウインドウを操作対象にする|⌥tab|
|Clear.app|GO Up a level|⌘[|
|メモ.app|スタイルを削除|⌘ shift x|

memo:
* Finder.app場所
`/System/Library/CoreServices/Finder.app`


**ターミナル設定**
Dockを素早く表示

```
defaults write com.apple.dock autohide-delay -float 0 && killall Dock
```

## Appインストール&設定

* [Dash.app](https://kapeli.com/dash)
* [Clear.app](https://apps.apple.com/jp/app/clear-%E3%82%BF%E3%82%B9%E3%82%AF-todo%E3%83%AA%E3%82%B9%E3%83%88/id504544917?mt=12)
* [Itsycal.app](https://www.mowglii.com/itsycal/)
* [Spectacle.app](https://www.spectacleapp.com/)
* [SpotMenu.app](https://kmikiy.github.io/SpotMenu/)


#### [Quicksilver.app](https://qsapp.com/)

**クリップボード履歴からペースト**
Install Clipboard Plugin
Triggers

|コマンド|⌘|トリガー|
|---|---|---|
|Execute Clip Store Paste 2|Keyboard|⌥V|
|Execute Clip Store Paste 3|Keyboard|⌃V|



#### [Sublimetext.app](https://www.sublimetext.com/)

メニュー ->  [Preferences] -> [Key Binding] 
`~/Library/Application Support/Sublime Text 3/Packages/User/Default (OSX).sublime-keymap`

```json
[
    {"keys": ["ctrl+tab"],   "command": "next_view"},
    {"keys": ["ctrl+shift+tab"],    "command": "prev_view"},
    { "keys": ["command+t"], "command": "new_file" }
]
```


**コマンドで起動**

```bash
sudo ln -s /Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl /usr/local/bin/subl
```


#### [VisualStudioCode.app](https://azure.microsoft.com/ja-jp/products/visual-studio-code/)

**タブの切り替えを順番通りに**
Cmd + Shift + P -> "基本設定: キーボードショートカットを開く (JSON)"
`~/Library/Application\ Support/Code/User/keybindings.json`

```json
[
    {
        "key": "ctrl+tab",
        "command": "workbench.action.nextEditor"
    },
    {
        "key": "ctrl+shift+tab",
        "command": "workbench.action.previousEditor"
    }
]
```


####iTerm.app

* Mac iTerm で iceberg のテーマを使う
https://qiita.com/tarosaiba/items/fcc399006025ebe9152c

* プログラミング用フォントRictyをMacにインストールする
https://qiita.com/segur/items/50ae2697212a7bdb7c7f

####[Karabiner-Elements.app](https://pqrs.org/osx/karabiner/)

**Complex Modifications**
[karabiner.json Reference Manual](https://pqrs.org/osx/karabiner/json.html)
`~/.config/karabiner/assets/complex_modifications`


- コマンドキーを単体で押したときに、英数・かなキーを送信する
- Map ctrl +[ to escape
- Exchange semicolon and colon
- F18 to Sleep
- F19 to Lock Screen
- Cmd + esc to Cmd + Delete
- caps_lock to left_control
- Cmd + caps_lock to Return
- ctrl + caps_lock to ctrl + shift + tab (前タブに移動)
- Cmd + ` to delete_forward

<details><summary>JSON code</summary><div>

```json:[0-9]{10}.json
{
  "title": "My favorite keymap",
  "rules": [
    {
      "description": "コマンドキーを単体で押したときに、英数・かなキーを送信する。（左コマンドキーは英数、右コマンドキーはかな)",
      "manipulators": [
        {
          "type": "basic",
          "from": {
            "key_code": "left_command",
            "modifiers": {
              "optional": [
                "any"
              ]
            }
          },
          "parameters": {
            "basic.to_if_held_down_threshold_milliseconds": 100
          },
          "to": [
            {
              "key_code": "left_command",
              "lazy": true
            }
          ],
          "to_if_held_down": [
            {
              "key_code": "left_command"
            }
          ],
          "to_if_alone": [
            {
              "key_code": "japanese_eisuu"
            }
          ]
        },
        {
          "type": "basic",
          "from": {
            "key_code": "right_command",
            "modifiers": {
              "optional": [
                "any"
              ]
            }
          },
          "parameters": {
            "basic.to_if_held_down_threshold_milliseconds": 100
          },
          "to": [
            {
              "key_code": "right_command",
              "lazy": true
            }
          ],
          "to_if_held_down": [
            {
              "key_code": "right_command"
            }
          ],
          "to_if_alone": [
            {
              "key_code": "japanese_kana"
            }
          ]
        }
      ]
    },
    {
      "description": "ctrl + [ to escape",
      "manipulators": [
        {
          "type": "basic",
          "from": {
            "key_code": "open_bracket",
            "modifiers": {
              "mandatory": ["control"],
              "optional": ["any"]
            }
          },
          "to": [
            {
              "key_code": "escape"
            }
          ]
        }
      ]
    },
    {
      "description": "Exchange semicolon and colon",
      "manipulators": [
        {
          "type": "basic",
          "from": {
            "key_code": "semicolon",
            "modifiers": {
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "key_code": "semicolon",
              "modifiers": [
                "left_shift"
              ]
            }
          ]
        },
        {
          "type": "basic",
          "from": {
            "key_code": "semicolon",
            "modifiers": {
              "mandatory": [
                "shift"
              ],
              "optional": [
                "caps_lock"
              ]
            }
          },
          "to": [
            {
              "key_code": "semicolon"
            }
          ]
        }
      ]
    },
    {
      "description": "F11 to Sleep",
      "manipulators": [
        {
          "type": "basic",
          "from": {
            "key_code": "f11"
          },
          "to": [
            {
              "key_code": "eject",
              "modifiers": ["left_option", "left_command"]
            }
          ]
        }
      ]
    },
    {
      "description": "F12 to Lock Screen",
      "manipulators": [
        {
          "type": "basic",
          "from": {
            "key_code": "f12"
          },
          "to": [
            {
              "key_code": "eject",
              "modifiers": ["left_control", "left_shift"]
            }
          ]
        }
      ]
    },
    {
      "description": "caps_lock to left_control",
      "manipulators": [
        {
          "type": "basic",
          "from": {
            "key_code": "caps_lock"
          },
          "to": [
            {
              "key_code": "left_control"
            }
          ]
        }
      ]
    },
    {
      "description": "left_Cmd + CapsLock to Return (左手でReturn)",
      "manipulators": [
        {
          "type": "basic",
          "from": {
            "key_code": "caps_lock",
            "modifiers": {
              "mandatory": [
                "left_command"
              ]
            }
          },
          "to": [
            {
              "key_code": "return_or_enter"
            }
          ]
        }
      ]
    },
    {
      "description": "left_Cmd + left_Ctrl to Return (左手でReturn、HHKB用)",
      "manipulators": [
        {
          "type": "basic",
          "from": {
            "key_code": "left_control",
            "modifiers": {
              "mandatory": [
                "left_command"
              ]
            }
          },
          "to": [
            {
              "key_code": "return_or_enter"
            }
          ]
        }
      ]
    },
    {
      "description": "ctrl + caps_lock to ctrl + shift + tab (前タブに移動)",
      "manipulators": [
        {
          "type": "basic",
          "from": {
            "key_code": "caps_lock",
            "modifiers": {
              "mandatory": [
                "left_control"
              ]
            }
          },
          "to": [
            {
                "key_code": "tab",
                "modifiers": ["left_control", "left_shift"]
            }
          ]
        }
      ]
    },
    {
      "description": "Cmd + ` to Cmd + Delete (左手で削除)",
      "manipulators": [
        {
          "type": "basic",
          "from": {
            "key_code": "grave_accent_and_tilde",
            "modifiers": {
              "mandatory": [
                "command"
              ]
            }
          },
          "to": [
            {
              "key_code": "delete_or_backspace",
              "modifiers": [
                "command"
              ]
            }
          ]
        }
      ]
    },
    {
      "description": "Cmd + esc to Cmd + Delete (左手で削除 HHKB用)",
      "manipulators": [
        {
          "type": "basic",
          "from": {
            "key_code": "escape",
            "modifiers": {
              "mandatory": [
                "command"
              ]
            }
          },
          "to": [
            {
              "key_code": "delete_or_backspace",
              "modifiers": [
                "command"
              ]
            }
          ]
        }
      ]
    },
    {
      "description": "ctrl + 3 to fastforward (次の曲)",
      "manipulators": [
        {
          "type": "basic",
          "from": {
            "key_code": "3",
            "modifiers": {
              "mandatory": [
                "control"
              ]
            }
          },
          "to": [
            {
                "key_code": "fastforward"
            }
          ]
        }
      ]
    }
  ]
}
```
</div></details>