LoginSignup
0
0

More than 5 years have passed since last update.

VSCodeVim:コマンド繰り返しのキーバインディング設定

Last updated at Posted at 2018-08-08

VSCodeVimプラグインのキーバインド設定にコマンドの繰り返しを定義する方法をまとめました。

画面単位のスクロール(<C-u> <C-d> <C-b> <C-f>)があまり合わないため、Vimでは J で10行上に移動するようなキーバインドを設定している。

noremap <S-j> 10j
noremap <S-k> 10k
noremap <S-h> 10h
noremap <S-l> 10l

この設定をVisual Studio Codeに入れるにはユーザー設定に下記のように記載する。

{
    "vim.normalModeKeyBindings": [
        {
            "before": ["H"],
            "after": ["1", "0", "h"]
        },
        {
            "before": ["J"],
            "after": ["1", "0", "j"]
        },
        {
            "before": ["K"],
            "after": ["1", "0", "k"]
        },
        {
            "before": ["L"],
            "after": ["1", "0", "l"]
        }
    ]
}

ポイントは、コマンドの繰り返しの指定は ["10h"] でも ["10", "h"] でもなく、["1", "0", "h"] と指定する必要があること。

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