VSCodeのターミナルでショートカットキーを使う
VSCodeのターミナルでショートカットキーを使えるようにしてみました。
使えるようにしたショートカットキー
移動
- 行頭
- Ctrl + a
- 行末
- Ctrl + e
- 前(右)
- Ctrl + f
- 後(左)
- Ctrl + b
- ワード単位で前(右)
- Esc + f
- ワード単位で後ろ(左)
- Esc + b
削除
- カーソルの文字
- Ctrl + d
- カーソルの一文字前
- Ctrl + h
- 行頭まで
- Ctrl + u
- 行末まで
- Ctrl + k
- ワード単位で行頭方向の文字列を
- Ctrl + w
その他
- 前のコマンド履歴
- Ctrl + p
- 次のコマンド履歴
- Ctrl + n
- 画面クリア
- Ctrl + l
VSCodeの設定
keybindings.json
に以下の設定をすることで上のショートカットを使えるようになりました
// Place your key bindings in this file to override the defaults [ { "key": "ctrl+a", "command": "", "when": "terminalFocus" }, { "key": "ctrl+e", "command": "", "when": "terminalFocus" }, { "key": "ctrl+b", "command": "", "when": "terminalFocus" }, { "key": "ctrl+f", "command": "", "when": "terminalFocus" }, { "key": "esc+b", "command": "", "when": "terminalFocus" }, { "key": "esc+f", "command": "", "when": "terminalFocus" }, { "key": "ctrl+d", "command": "", "when": "terminalFocus" }, { "key": "ctrl+h", "command": "", "when": "terminalFocus" }, { "key": "ctrl+u", "command": "", "when": "terminalFocus" }, { "key": "ctrl+k", "command": "", "when": "terminalFocus" }, { "key": "ctrl+w", "command": "", "when": "terminalFocus" }, { "key": "ctrl+p", "command": "", "when": "terminalFocus" }, { "key": "ctrl+n", "command": "", "when": "terminalFocus" }, { "key": "ctrl+l", "command": "", "when": "terminalFocus" } ]