5
5

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

VSCodeでもMacのカーソル移動とかがしたい!

Last updated at Posted at 2019-08-26

emacs風のキーバインドをVSCodeにも導入する.

対象

Windowsを対象にしている.(Macでは何もしなくてもできるため)

やること

  • emacsのカーソル移動,文字削除とかをできるようにしたい.
  • VSCode内の本来の機能はできるだけ失わないようにしたい.

変更

VSCode内のkeybindings.jsonの中をいじってキーバインドを変更する.
既存のキーと衝突するときは既存のものにAltを足して回避する.

keybindings.json
[
  {
    "key": "ctrl+p",
    "command": "cursorUp",
    "when": "editorTextFocus"
  },
  {
    "key": "ctrl+alt+p",
    "command": "workbench.action.quickOpenNavigateNext",
    "when": "inQuickOpen"
  },
  {
    "key": "ctrl+alt+p",
    "command": "workbench.action.quickOpen"
  },
  {
    "key": "ctrl+n",
    "command": "cursorDown",
    "when": "editorTextFocus"
  },
  {
    "key": "ctrl+alt+n",
    "command": "workbench.action.files.newUntitledFile"
  },
  {
    "key": "ctrl+f",
    "command": "cursorRight",
    "when": "editorTextFocus"
  },
  {
    "key": "ctrl+alt+f",
    "command": "defaultSettings.action.focusSearch",
    "when": "defaultSettingsEditor"
  },
  {
    "key": "ctrl+alt+f",
    "command": "actions.find"
  },
  {
    "key": "ctrl+b",
    "command": "cursorLeft",
    "when": "editorTextFocus"
  },
  {
    "key": "ctrl+alt+b",
    "command": "workbench.action.toggleSidebarVisibility"
  },
  {
    "key": "ctrl+a",
    "command": "cursorHome",
    "when": "editorTextFocus"
  },
  {
    "key": "ctrl+alt+a",
    "command": "editor.action.selectAll"
  },
  {
    "key": "ctrl+e",
    "command": "cursorEnd",
    "when": "editorTextFocus"
  },
  {
    "key": "ctrl+alt+e",
    "command": "workbench.action.quickOpenNavigateNext",
    "when": "inQuickOpen"
  },
  {
    "key": "ctrl+alt+e",
    "command": "workbench.action.quickOpen"
  },
  {
    "key": "ctrl+k ctrl+k",
    "command": "deleteAllRight",
    "when": "editorTextFocus"
  },
  {
    "key": "ctrl+d",
    "command": "deleteRight",
    "when": "editorTextFocus"
  },
  {
    "key": "ctrl+h",
    "command": "deleteLeft",
    "when": "editorTextFocus"
  },
  {
    "key": "ctrl+alt+h",
    "command": "editor.action.startFindReplaceAction"
  },
  {
    "key": "ctrl+h",
    "command": "-editor.action.startFindReplaceAction"
  }
]

感想

今のところなにも違和感なく使うことができている.ただウィンドウ内検索するときなど何も考えずにctrl+fを押してただカーソルが動くだけの時が時々発生する.

よく使う既存のショートカットは別に割り当てるのも必要なのかもしれない.

参考にしたサイト

5
5
0

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
5
5

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?