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…


This content originally appeared on DEV Community and was authored by Rico Sta. Cruz

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"] },
}


This content originally appeared on DEV Community and was authored by Rico Sta. Cruz


Print Share Comment Cite Upload Translate Updates
APA

Rico Sta. Cruz | Sciencx (2022-03-29T02:37:27+00:00) Faster multi-line jumps in VSCode-Vim. Retrieved from https://www.scien.cx/2022/03/29/faster-multi-line-jumps-in-vscode-vim/

MLA
" » Faster multi-line jumps in VSCode-Vim." Rico Sta. Cruz | Sciencx - Tuesday March 29, 2022, https://www.scien.cx/2022/03/29/faster-multi-line-jumps-in-vscode-vim/
HARVARD
Rico Sta. Cruz | Sciencx Tuesday March 29, 2022 » Faster multi-line jumps in VSCode-Vim., viewed ,<https://www.scien.cx/2022/03/29/faster-multi-line-jumps-in-vscode-vim/>
VANCOUVER
Rico Sta. Cruz | Sciencx - » Faster multi-line jumps in VSCode-Vim. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2022/03/29/faster-multi-line-jumps-in-vscode-vim/
CHICAGO
" » Faster multi-line jumps in VSCode-Vim." Rico Sta. Cruz | Sciencx - Accessed . https://www.scien.cx/2022/03/29/faster-multi-line-jumps-in-vscode-vim/
IEEE
" » Faster multi-line jumps in VSCode-Vim." Rico Sta. Cruz | Sciencx [Online]. Available: https://www.scien.cx/2022/03/29/faster-multi-line-jumps-in-vscode-vim/. [Accessed: ]
rf:citation
» Faster multi-line jumps in VSCode-Vim | Rico Sta. Cruz | Sciencx | https://www.scien.cx/2022/03/29/faster-multi-line-jumps-in-vscode-vim/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.