12
3

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 5 years have passed since last update.

VSCodeVimで行表示値の切り替えをショートカット化したい時のTips

Last updated at Posted at 2019-05-02

TL;DR

  • 行表示切替の設定をショートカット登録(VSCodeVim)
  • Settings Cycler」を使用して、拡張機能内の設定を切り替える

行表示の設定とは

vimの場合

vimの場合
set number         " 行頭からの絶対値で表示
set relativenumber " 現在行からみた相対値で表示

VSCodeの場合

設定 > Editor: Line Numbers を切り替え

  • on / off ... 行番号の表示 / 非表示(絶対値)
  • relative ... カーソル位置までの相対値
  • interval ... 10行ごとに表示(絶対値)

表示切替の方法

ショートカットで設定を切り替えたいんだけどどうすれば...:weary:

  1. 拡張機能から「Settings Cycler」をインストール
  2. keybindings.jsonに以下の設定を追加
keybindings.json
// number/relativenumberの切り替え
{
    "key": "f3",
    "command": "settings.cycle",
    "when": "editorTextFocus",
    "args": {
        "id": "relativeLineNumbers",
        "values": [
            {
                "editor.lineNumbers": "on"
            },
            {
                "editor.lineNumbers": "relative"
            }
        ]
    }
}

これでF3キーで切り替えができるようになります:laughing:

12
3
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
12
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?