replit / codemirror-vim

Vim keybindings for CM6
https://www.npmjs.com/package/@replit/codemirror-vim
MIT License
289 stars 30 forks source link

CM default indent/dedent of Cmd + Square Brackets is not suppressed when vim is the chosen flavor #168

Closed blast-hardcheese closed 6 months ago

blast-hardcheese commented 6 months ago

Good day! The behavior I'm seeing here is that the default indent/dedent shortcut is left as a fallback to the vim binding of ^d/^t. I've verified this behavior in https://raw.githack.com/replit/codemirror-vim/master/dev/web-demo.html, with a video demo below to go along with my repro steps:

  1. Observe that in normal mode, Command+[ or Command+] incorrectly dedent or indent
  2. Switch to insert mode
  3. Observe that ^d and ^t

cm vim

nightwing commented 6 months ago

I think allowing fallback to default codemirror behavior for all shortcuts that are not handled by vim was intentional design choice of the original cm5 vim mode. In which usage scenarios does this create any problems?

blast-hardcheese commented 6 months ago

The problem is one of usability -- Cmd+[/Cmd+] are the system bindings for Navigate Back/Navigate Forward, so by having the fallback from vim to the standard bindings, I not only have have two ways to do the same thing, but I also can't use the standard OS bindings for navigating forwards and backwards.

What would be ideal, though it may not be easy to do, is to only fall back to the standard keybindings for operations that do not have a vim-mode binding.

masad-frost commented 6 months ago

I think allowing fallback to default codemirror behavior for all shortcuts

I think this makes sense from the library's perspective. Will close the issue out.

I think this is about how we configure our editor, on replit.com, we can probably remove the default keybindings when we use the vim keybindings. I remember we added the defaults for some reason, we can investigate.