DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’»

DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’» is a community of 966,904 amazing developers

We're a place where coders share, stay up-to-date and grow their careers.

Create account Log in
Rico Sta. Cruz
Rico Sta. Cruz

Posted on

Faster multi-line jumps in VSCode-Vim

One of the things that bothered me with VSCode-Vim was with how slow it was to use (number)(arrow) (eg, 42(down)) to move multiple lines down. In the screencast below, notice how it goes line-by-line rather than skipping ahead instantly.

☝ Figure 1: VSCode scrolls slooowly line-by-line when pressing 42(down).


Solution: use j/k

TIL that VSCode-Vim already accounts for this with hjkl movements, so 42(down) can be pressed at 42j.

☝Figure 2: Using j/k keys (eg, 3j instead of 3(down)) hops to the target line instantly. I also did a trick to make this work with arrow keys (see below).


Making it work with arrow keys

To make this work with (up) and (down) arrow keys too, I rebound my arrow keys to j/k movements.

/* settings.json */
{
  "vim.normalModeKeyBindings": [
    // Make "9j 9k" work faster
    { "before": ["Down"], "after": ["j"] },
    { "before": ["Up"], "after": ["k"] },
}
Enter fullscreen mode Exit fullscreen mode

Top comments (0)

🌚 Life is too short to browse without dark mode