4

Does anyone use Vim with VSCode? For some reason, my <leader> key (space), does not activate the easy-motion plugin (I made sure it is enabled in the settings), but just moves the cursor to the right once. I am new to VS Code, am I missing something? I still haven't figured out how .vimrc works with VS Code.

TIA!

isAif
  • 2,126
  • 5
  • 22
  • 34
andriy
  • 105
  • 2
  • 8
  • Looks like your `.vimrc` file is conflicting with the vim plugin, first disable use of `vimrc` and then try to use easymotion. – isAif Aug 11 '20 at 09:33
  • @isAif tried this, thank you. I believe VS Code does not emulate vim properly, so I might as well fully switch back to the regular terminal vim. Thank you tho! I will still appreciate any useful advice :) – andriy Aug 12 '20 at 09:09

2 Answers2

12

It's not nessesary to use .vimrc file for vscode unless you want some customized behaviors.

  • Make sure you've enbaled the easymotion in vsvim settings:

    "vim.easymotion": true

    (in your settings.json file)

  • When it comes to VSCode, easymotion will be triggered by double press <leader> key.
    Different from Terminal Vim, for example: (in your case <leader> is set to space)

    space + space + 2 + s

    after you press the above keys, your status bar should look like this.

Hope it would help you get into Visual Studio Code quickly.

s3cret
  • 354
  • 2
  • 10
  • Thank you for mentioning the double press on leader. I was confused as to why EasyMotion wasn't working when leader works fine in consoles. VS Code quirks! \o/ – Feynt Feb 04 '22 at 08:02
11

As far as I know, vim mode in VS code isn't configured by .vimrc file, instead, it's configured by setting.json. You can find how to configure them in this README.md.

Check that:

  • "vim.leader"is set to <Space>
  • go to preference -> Keyboard shortcut in VS code. Make sure that you did not customize any command to any shortcut starting with <space>. (I made this mistake before)
  • the timeout length of the leader key is pretty short, make sure you press, let's say, 'w' key right after <leader><leader>

I hope this would help

Marco Bonelli
  • 63,369
  • 21
  • 118
  • 128
  • 2
    Another thing I needed to do was disable "Add period with double-space" on OSX so that the `` combo registered smoothly. – tiki Jun 22 '23 at 03:28
  • 1
    @tiki: tysm for it as i was confused why easymotion was not being triggered smoothly – Isaac Jul 16 '23 at 10:18