zed icon indicating copy to clipboard operation
zed copied to clipboard

vim: Fix escape key switching back to default mode instead of normal mode

Open sethstha opened this issue 5 months ago • 3 comments

Closes #31728

When "default_mode: "insert", hitting escape was not switching to normal mode. Recently, changes to SwitchToNormalMode action was modified to change mode into default_mode instead or actually switching to Normal mode. Same with the NormalBefore

Release Notes:

  • Fixed - escape key not switching to normal mode when default_mode is insert

sethstha avatar Jun 01 '25 02:06 sethstha

We've gotten a bit muddled up with default_mode, as that is also how helix mode is enabled.

Cross positing from https://github.com/zed-industries/zed/pull/28103#issuecomment-2931997745

I think the right fix here is:

  • {"vim": {"default_mode": ""}} should be the mode you start in by default (expected to be "normal" or "insert")
  • {"helix_mode": true} should be added as a top level key. If it is enabled, then vim_mode is also enabled, and when switching to normal mode, vim picks Helix normal instead of Vim normal.

Happy to pair on this (https://cal.com/conradirwin/pairing), or if you want to take a pass at it, feel free.

ConradIrwin avatar Jun 02 '25 18:06 ConradIrwin

I already have a working prototype which uses "helix_mode": true but inside the vim settings.

My concerned is what happens when user has "helix_mode": true on top level but also has "vim_mode": false?

For now, I will enable vim_mode when helix_mode is enabled.

sethstha avatar Jun 03 '25 01:06 sethstha

That sounds right to me, thanks!

ConradIrwin avatar Jun 03 '25 02:06 ConradIrwin

@ConradIrwin I have added helix_mode settings as we discussed.

sethstha avatar Jun 08 '25 14:06 sethstha

Thanks for this, and sorry for the slow response! I've merged this into the vim mode setting crate (As a large number of crates causes slowness, it seemed better to have one tiny one than two).

Will merge when tests pass.

ConradIrwin avatar Jun 18 '25 21:06 ConradIrwin

When I press d for deleting a character I end up in vim normal mode instead of helix normal

Dreaming-Codes avatar Jul 02 '25 14:07 Dreaming-Codes