Skip to content

Allow CM6 keymaps before vim extension #244

@liamhess

Description

@liamhess

Hey,
In our setup we want to capture the escape key before and after the vim extension receives it and decide with the returned boolean whether the next handler should get the event or not. However if I understand correctly, this behavior is currently not supported? Because if you have a look at my setup here, the issue is that as soon as you add a second keymap, the vim extension doesn't get any Escape key events anymore and you basically can't exit insert mode once you enter it.
Now I've seen that there were attempts to do this before, that were dismissed #93.
So is it possible to pick up the PR for this again or do you guys know any alternative for me to achieve a similar behavior?

To reproduce:

import { EditorView, keymap } from "@codemirror/view";
import { vim } from "@replit/codemirror-vim";

new EditorView({
	extensions: [
		keymap.of([{ key: "Escape", run: () => false }]),
		vim(),
		keymap.of([{ key: "Escape", run: () => true }]),
	],
	parent: document.body,
});

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions