0
0

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.

VSCode+Vim拡張でスマートデリート

Last updated at Posted at 2019-03-23

環境

  • Ubuntu 18.04 LTS
  • VSCode 1.32.3
  • VSCode Vim 1.2.0

インデント消去できない問題

VSCode+Vim拡張を使ってるとBackspace or Ctrl+hでインデント1つ分を消そうとしてもスペース1つ分しか消去されないという問題がある(Vim拡張入れなければ起こらない)。
文で説明するより見てもらったほうが早い。
before.gif

解決法

keybindings.jsonに以下を書き込んでVSCodeのdeleteLeftコマンドを割り当てれば良い。

keybindings.json
[
    // インサートモードBackspace,Ctrl+hでカーソル左の文字を消去
    // 明示しなくても使えるがSmartDeleteが効くようになる
    {"key": "ctrl+h",    "command": "deleteLeft",
                            "when": "vim.mode == 'Insert'"},
    {"key": "backspace", "command":  "deleteLeft",
                            "when": "vim.mode == 'Insert'"},
]

結果

after.gif

にっこり😊

P.S.

VS Code 1.31 の気になった変更点
こちらの記事で知ったのですがCtrl+Hとか押したキーを画面に表示してるのはVSCode本体のスクリーンキャストモードという機能です。
やっぱしVSCode強いですね。
とっても便利なのでみなさんもぜひ使って見てください。

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?