Bukov
Bukov

Reputation: 656

Visual Studio Code Vim: How do I bind shift-space

I'm trying to use Vim mode in Visual Studio Code, using their VSCodeVim extension

In my old vimrc it looks like:

map <S-space> <Esc>

In Code's settings.json I've tried:

"vim.insertModeKeyBindingsNonRecursive": [
    {
        "before": ["<S-Space>"],
        "after": ["<Esc>"]
    }
],

Doesn't work :(

Upvotes: 2

Views: 2693

Answers (2)

sparker
sparker

Reputation: 11

Add this to keybindings.json:

{
  "key": "shift+space",
  "when": "editorTextFocus && vim.active && vim.mode == 'Insert' && !editorHasSelection",
  "command": "extension.vim_escape",
}

vscodevim doesn't seem to support it dirctly now,

I'm using space and shif+space to scroll (like in browsers), this can also achieved by using vscode's api:

{
      "key": "shift+space",
      "command": "cursorMove",
      "args": { "to": "up", "by": "line", "value": 5 }
}

other in settings.json

Upvotes: 0

Bukov
Bukov

Reputation: 656

Looks like a bug in their addon, not something I was doing wrong.

Here's a workaround

Inside just the normal keybindings.json:

{
    "key": "shift+space",
    "command": "extension.vim_escape",
    "when": "editorTextFocus"
 },

Upvotes: 3

Related Questions