Disable all default keymap

I like to implement Vim like “Command Mode” where you can toggle between regular mode and command mode, where any key stroke is some sort of command.

I was able to toggle keymap and make editor readOnly mode to mimic Command Mode using dynamic configuration technique with Compartment. However, even if I don’t specify defaultKeymap to its configuration (or set empty keymap), all cursor key as well as emacs keybinding in macOS (ctrl+f, b, n, p) still works in readOnly editor.

I also notice that typing any single character that is not assigned to keymap would move cursor forward which seems a bug or awkward behavior at least.

Is there any way to disable all default key bindings? How codemirror-vim implements its command mode behavior??

What you’re seeing is your browser’s native handling of those keys.

That’s already fixed in the current version of @codemirror/view.

1 Like