Introduction

Here's how to use Vim inside of Sublime Text or VS Code. It's simple to enable and once you get used to the features, it will supercharge your coding speed.

Prerequisite

Requires the installation of Sublime Text or VS Code (duh).

Enabling Vim in Sublime Text

Vim is called Vintage in Sublime Text and is disabled by default, via the ignored_packages setting. Just remove it from the ignored packages to enable it.

  1. Select Preferences from the menu, then select Settings.
  2. You can see "ignored_packages": ["Vintage"] in the Default Settings on the left window. Add "ignored_packages": [] to the User settings in the right window to overwrite it and then save the update.
  3. Vintage mode is now enabled. You can confirm by looking for "INSERT MODE" in the status bar in the bottom left of the window.

By default, Vim uses the ESC key to change the editor mode to "COMMAND MODE", which I feel is inconvenient for a frequently used key, so I usually rebind it to a shortcut that is more accessible.

You can rebind your keys by going to Preference > Key Bindings. The following block will rebind the switch to "COMMAND MODE" to "JK" which is what I usually use.

{
    "keys": ["j", "k"],
    "command": "exit_insert_mode",
    "context":
    [
        { "key": "setting.command_mode", "operand": false },
        { "key": "setting.is_widget", "operand": false }
    ]
}

Enabling Vim in VS Code

  1. Install the Vim extension

  2. To update the key binding go to Preferences > Setting > Vim: Command Line Mode Key Bindings > settings.json.

    "vim.insertModeKeyBindings": [
        {
            "before": ["j", "k"],
            "after": ["<esc>"]
        }
    ],