LoginSignup
13
13

More than 3 years have passed since last update.

vscode のキーバインドにmacのカーソル移動を設定する

Last updated at Posted at 2019-03-27

macのカーソル移動のショートカット

最近知ったのですが、macではctrl+f or bで前後にカーソル移動できます。

コマンド 動作
ctrl + f カーソル右に移動
ctrl + b カーソル左に移動
ctrl + e カーソル行の末尾に移動
ctrl + a カーソル行の先頭に移動

今まではキーボード右下の矢印キーを使って移動していたのですが、このショートカットを知ってから全く矢印キーを使わなくなりました。

理由はたったひとつ・・・

ホームポジションから手を動かさなくて済む!!!

これに尽きます。

矢印キーでのカーソル移動だとどうしてもホームポジションから手を動かさなくてはならないんですよね。しかも意外とこれがストレスだったりします。

このショートカットを知ってからタイピングでのカーソル移動のストレスがかなり減りました!

VSCodeでもこのカーソル移動がしたい

やはりコーディングの時にこのカーソル移動がしたいので、vscodeのキーバインディングの設定をしました。

単なるカーソル移動はキーボードショートカットの設定から行うことができました。しかし、shit+このカーソル移動による文字選択の設定項目が見つかりませんでした。

これを設定するには、vscodeのkeybindings.jsonファイルに直接書き込む必要があります。

設定はとても簡単。以下のjson形式の記述をkeybindings.jsonに追記するだけ。

keybindings.json
{
    "key": "ctrl+shift+n",
    "command": "cursorDownSelect",
    "when": "editorTextFocus"
  },
  {
    "key": "ctrl+shift+p",
    "command": "cursorUpSelect",
    "when": "editorTextFocus"
  },
  {
    "key": "ctrl+shift+f",
    "command": "cursorRightSelect",
    "when": "editorTextFocus"
  },
  {
    "key": "ctrl+shift+b",
    "command": "cursorLeftSelect",
    "when": "editorTextFocus"
  },
  {
    "key": "ctrl+shift+a",
    "command": "cursorHomeSelect",
    "when": "editorTextFocus"
  },
  {
    "key": "ctrl+shift+e",
    "command": "cursorEndSelect",
    "when": "editorTextFocus"
  }  

これでshit+ctrl + f or b or e or aでの選択が可能となりました。

べんり〜〜

13
13
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
13
13