VSCodeVim / VSCodeVim/Vim

Insert mode `<C-m>` and `<C-j>` should behave the same as the Enter key

Open
#6,854 1 comment 1 reaction 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

Is your feature request related to a problem? Please describe.
In vim insert mode <C-m> is the exact same as Enter / <CR>. In VSCodeVim it just inserts a newline character.
This is an issue because it does not indent the next line if it needs indentation. Some extensions also run functionality on the Enter key.

Another problem because of this is you can't use <C-m> to select suggestions / auto-completion like you can in vim (#5497).

Describe the solution you'd like
Make it the same as the Enter key.

Describe alternatives you've considered

Adding a keybinding with the command editor.action.insertLineAfter, but if you use in the middle of the line, it doesn't work as desired.

Using vim.insertModeKeyBindingsNonRecursive works:

{
    "vim.insertModeKeyBindingsNonRecursive": [
        {
            "before": ["<C-m>"],
            "after": ["<Enter>"]
        }
    ],
}

But it should be default behavior.

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 tracing the VSCodeVim insert-mode key handling for Ctrl-M, Ctrl-J, and Enter. Compare their behavior for line breaks, indentation, and completion selection, then add or update focused tests if the relevant test entry point is found. Done means both control keys behave like Enter in insert mode, including in the middle of a line.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
tooling
Issue type
Feature
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.