VSCodeVim / VSCodeVim/Vim

Cannot make a key binding for Shift+Enter (normalModeKeyBindingsNonRecursive)

Open
#5,122 7 comments 5 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

kind/bug
Dominant language
TypeScript
Stars
15.2k
Forks
1.5k
Avg merge
3d 18h
Merged PRs (30d)
6

Description

Describe the bug

I'm trying to remap <Enter> and <Shift>+<Enter> to create new lines in Vim normal mode.

<Enter> works as intended, but <Shift>+<Enter> doesn't work. Here's the relevant setting.json:

    "vim.normalModeKeyBindingsNonRecursive": [
      {
          "before": ["<Enter>"],
          "commands": ["editor.action.insertLineAfter"]
      },
      {
        "before": ["<Shift>", "<Enter>"],
        "commands": ["editor.action.insertLineBefore"]
      }
    ],

I've tried other strings like <S-CR>, which don't work either. What am I missing?

(I've also disabled all Keyboard Shortcuts that use shift+enter.)

Environment (please complete the following information):

  • Extension (VsCodeVim) version: 1.16.0
  • VSCode version: 1.47.3
  • OS: macOS 10.15.6

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the setting.json configuration using vim.normalModeKeyBindingsNonRecursive in VSCodeVim, with the and + mappings shown. Trace the keybinding entry point and compare the handling of these sequences; done means Shift+Enter invokes editor.action.insertLineBefore while Enter continues to invoke editor.action.insertLineAfter.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript, vscode
Domain
developer-experience, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.