Vim: leader: Can't use <space> in "vim.leader" setting

Created on 7 Dec 2016  路  8Comments  路  Source: VSCodeVim/Vim

Please thumbs-up 馃憤 this issue if it personally affects you! You can do this by clicking on the emoji-face on the top right of this post. Issues with more thumbs-up will be prioritized.


What did you do?

Defined <space> as leader key in my User/settings.json. Restarted. And tried some easymotion combinations (e.g. <leader> <leader> s <char>).

~json
{
"vim.leader": "",
"vim.easymotion": true
}
~

Background: Having the space key as leader key is inspired by evil mode (vim mode) in the Spacemacs Emacs distribution.

What did you expect to happen?

The space key should do nothing, but it should work for easymotion commands.

What happened instead?

The space key jumped to the next cell in the text editor.

When I use " " instead of "<space>" as vim.leader it works as expected.

Technical details:

  • VSCode Version: 1.8.0-insider (2016-12-06T16:09:29.346Z).
  • VsCodeVim Version: 0.4.9.
  • OS: Ubuntu 16.04 LTS.

Most helpful comment

I have used all snippets available and nothing works.

When setting "vim.leader": " " or "vim.leader": "<space>" all <leader> presses end up hanging VSCode, causing me to have to restart the entire editor.

All 8 comments

Also note. My intention is to later use <space> or <leader> to define new key bindings for other modes.

~json
"vim.otherModesKeyBindingsNonRecursive": [
{
"before": [ "", "o" ],
"after": [],
"commands": [
{ "command": "workbench.action.quickOpen", "args": [] }
]
}
]
~

Currently when I set vim.leader to "<space>" the whole command does not work. But it works when it is set to " ".

Also somehow the combination only works once:

  • space o — opens the quick open widget.
  • space o esc space o — opens the quick open widget, closes it, and does nothing.
  • space o esc esc space o — opens the quick open widget, closes it, and opens it again.

Update: It works as expected (i.e. space o esc space o) when I add esc into the after array .

~json
"vim.otherModesKeyBindingsNonRecursive": [
{
"before": [ "", "o" ],
"after": [ "" ],
"commands": [
{ "command": "workbench.action.quickOpen", "args": [] }
]
}
]
~

I'm also trying to use something like that and it's not working:

"vim.otherModesKeyBindingsNonRecursive": [
{
    "before": ["<space>", "f", "s"],
    "after": [],
    "commands": [
        { "command": "workbench.action.files.save", "args": [] }
    ]
}

@vadimi Could you also try using " " instead of "<space>" and see if that works?

@johnfn tried that too on macOS and Windows 7 - no luck.

I cannot even use "vim.leader": " ",

This gives me Unknown configuration setting:

2016-12-19 10_50_26-settings json - bmfsfj-frontend-resources - visual studio code

Also there's no default vim.leader in the default settings.json in my case. Current stable VSCode and current version of VSCodeVim.

I cannot even use "vim.leader": " ",

This gives me Unknown configuration setting:

2016-12-19 10_50_26-settings json - bmfsfj-frontend-resources - visual studio code

Also there's no default vim.leader in the default settings.json in my case. Current stable VSCode and current version of VSCodeVim.

i used and it works fine along with @hastebrot snippet.

I have used all snippets available and nothing works.

When setting "vim.leader": " " or "vim.leader": "<space>" all <leader> presses end up hanging VSCode, causing me to have to restart the entire editor.

Doesn't work for me either. I'm going to create a new issue, as it seems this was never actually fixed.

Version: 1.45.1
Commit: 5763d909d5f12fe19f215cbfdd29a91c0fa9208a
Date: 2020-05-14T08:27:22.494Z
Electron: 7.2.4
Chrome: 78.0.3904.130
Node.js: 12.8.1
V8: 7.8.279.23-electron.0
OS: Linux x64 5.3.0-51-generic
Was this page helpful?
0 / 5 - 0 ratings

Related issues

WangRongda picture WangRongda  路  3Comments

triztian picture triztian  路  3Comments

rajinder-yadav picture rajinder-yadav  路  3Comments

orn688 picture orn688  路  3Comments

waltiam picture waltiam  路  3Comments