LoginSignup
1
0

Visual Studio CodeのVsCodeVim/VimでCtrl+Pなど競合するキーバインドを無効化する

Last updated at Posted at 2024-02-23

備忘録

File→Preferences→Keyboard Shortcutsを開き、extension.vimで検索すると拡張機能を入れたことで影響を与えるキーバインドが確認できる。

大雑把。網羅はしていない
 

  1. Visual Studio CodeのExtensionsより、PubulisherがvscodevimのVimに対してInstallを押下する
  2. F1キー押下→「settings json」など入力し、Preferences: Open User Settings (JSON)またはPreferences: Open Default Settings (JSON)を選択する
  3. 下記の内容で更新して保存する
    settings.json
    {
        "vim.useSystemClipboard": true, // OS側とのクリップボードの共有
        // 競合するショートカットを無効化
        "vim.handleKeys": {
            "<C-[>": false,
            "<C-]>": false,
            "<C-^>": false,
            "<C-6>": false,
            "<C-a>": false,
            "<C-b>": false,
            "<C-c>": false,
            "<C-d>": false,
            "<C-e>": false,
            "<C-f>": false,
            "<C-g>": false,
            "<C-h>": false,
            "<C-i>": false,
            "<C-j>": false,
            "<C-k>": false,
            "<C-l>": false,
            "<C-m>": false,
            "<C-n>": false,
            "<C-o>": false,
            "<C-p>": false,
            "<C-q>": false,
            "<C-r>": false,
            "<C-s>": false,
            "<C-t>": false,
            "<C-u>": false,
            "<C-v>": false,
            "<C-w>": false,
            "<C-x>": false,
            "<C-y>": false,
            "<C-z>": false
          }
    }
    
  4. F1キー押下→「shortcuts json」など入力し、Preferences: Open Keyboard Settings (JSON)を選択する
  5. 下記の内容で更新して保存する
    keybindings.json
    // Place your key bindings in this file to override the defaults
    [
        { "key": "ctrl+up", "command": "-extension.vim_ctrl+up"},
        { "key": "ctrl+down", "command": "-extension.vim_ctrl+down"},
        { "key": "ctrl+left", "command": "-extension.vim_ctrl+left"},
        { "key": "ctrl+right", "command": "-extension.vim_ctrl+right"},
        { "key": "backspace", "command": "-extension.vim_backspace"},
        { "key": "delete", "command": "-extension.vim_delete"},
        { "key": "tab", "command": "-extension.vim_tab"}
    ]
    
1
0
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
1
0