Insert mode `<C-m>` and `<C-j>` should behave the same as the Enter key
Nobody has claimed this yet.
- 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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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