VSCode VIM Part I - EasyMotion
Preview
VS Code, as the number one IDE in the universe ☝🏻, still feels slightly worse than LazyVim for text jumping. I found that the VSCode Vim extension supports EasyMotion. With some keybinding tweaks, it can imitate LazyVim in a rough way. The result looks like this:
Of course, you can also install a Neovim extension and use LazyVim plugins directly inside VS Code. The Neovim extension is said to have better performance, though stability is not guaranteed.
Setup
Paste the following configuration into VS Code’s settings.json. It uses the Catppuccin Mocha theme, btw.{ // leader key, set to the equals key here "vim.leader": "=", // Enable EasyMotion "vim.easymotion": true, // Catppuccin Mocha Color Scheme "vim.easymotionDimBackground": true, "vim.easymotionMarkerBackgroundColor": "#1e1e2e", "vim.easymotionMarkerForegroundColorOneChar": "#f38ba8", "vim.easymotionMarkerForegroundColorTwoCharFirst": "#fab387", "vim.easymotionMarkerForegroundColorTwoCharSecond": "#f9e2af", "vim.easymotionIncSearchForegroundColor": "#a6e3a1", "vim.easymotionDimColor": "#6c7086", "vim.easymotionMarkerFontWeight": "bold", // LazyVim-Like Key Bindings "vim.normalModeKeyBindings": [ { "before": ["s"], "after": ["<leader>", "<leader>", "/"] }, { "before": ["f"], "after": ["<leader>", "<leader>", "f"] }, { "before": ["F"], "after": ["<leader>", "<leader>", "F"] } ]}
If you are not used to Vim-style operations, you can use these extensions to achieve similar functionality:
- jumpy - Visual Studio Marketplace
- Jump - Visual Studio Marketplace
- Find => Jump - Visual Studio Marketplace
The VSCode Vim extension probably does not support directly modifying EasyMotion keybindings. The configuration above is a workaround.
Take <ldr><ldr> / <char> ... <CR> as an example. Add a mapping in normalModeKeyBindings, so when s is pressed, it is replaced with <ldr><ldr> /, and then you can enter any character to search.
Keybinding Reference
| Motion Command | Description |
|---|---|
<ldr><ldr> s <char> | Search character |
<ldr><ldr> f <char> | Find character forwards |
<ldr><ldr> F <char> | Find character backwards |
<ldr><ldr> t <char> | Til character forwards |
<ldr><ldr> T <char> | Til character backwards |
<ldr><ldr> w | Start of word forwards |
<ldr><ldr> b | Start of word backwards |
<ldr><ldr> l | Matches beginning & ending of word, camelCase, after _, and after # forwards |
<ldr><ldr> h | Matches beginning & ending of word, camelCase, after _, and after # backwards |
<ldr><ldr> e | End of word forwards |
<ldr><ldr> ge | End of word backwards |
<ldr><ldr> j | Start of line forwards |
<ldr><ldr> k | Start of line backwards |
<ldr><ldr> / <char>... <CR> | Search n-character |
<ldr><ldr><ldr> bdt | Til character |
<ldr><ldr><ldr> bdw | Start of word |
<ldr><ldr><ldr> bde | End of word |
<ldr><ldr><ldr> bdjk | Start of line |
<ldr><ldr><ldr> j | JumpToAnywhere motion; default behavior matches beginning & ending of word, camelCase, after _ and after # |
Ref
VSCodeVim/Vim: ⭐ Vim for Visual Studio Code
ggandor/leap.nvim: Neovim’s answer to the mouse 🦘

