これまでエディタやターミナル間の切り替えをクリックで行っていたのですが、少しストレスに感じていました。そこで、キーバインドを設定してみたところかなり快適になったのでご紹介します。
今回設定したものはこちらです。僕はVimmerなのでVimっぽいショートカットにしました。
キーバインド | 動作 |
---|---|
Ctl + h | エディタ→サイドバー |
Ctl + j | エディタ→ターミナル |
Ctl + l | サイドバー→エディタ |
Ctl + k | ターミナル→エディタ |
環境
- Visual Studio Code 1.27.2
- macOS Sierra
手順
Code > Preferences > Keyboard Shortcuts
をクリック

「keybindings.json」をクリックして設定ファイルを開きます

このように設定します。「key」はお好みで設定してみてください。
keybindings.json
[
{
"key": "ctrl+h",
"command": "workbench.action.focusSideBar",
"when": "editorTextFocus"
},
{
"key": "ctrl+j",
"command": "workbench.action.terminal.focus",
"when": "editorTextFocus"
},
{
"key": "ctrl+l",
"command": "workbench.action.focusFirstEditorGroup",
"when": "filesExplorerFocus"
},
{
"key": "ctrl+k",
"command": "workbench.action.focusFirstEditorGroup",
"when": "terminalFocus"
}
]
よいVSCodeライフを!
参考にさせていただいた記事
https://qiita.com/rai_suta/items/05e69f0b9065989b19c1