zed-industries / zed

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
https://zed.dev
Other
41.58k stars 2.16k forks source link

Vim mode: Difficulties attempting to rename a symbol #11882

Open kolunmi opened 2 months ago

kolunmi commented 2 months ago

Check for existing issues

Describe the bug / provide steps to reproduce it

Hello! When attempting to rename a symbol using the editor: rename command in vim mode, regular keystrokes seem to randomly cancel the operation.

Screencast_from_2024-05-15_11-56-22.webm

In this video, trying to type a character into the entry will cause it to exit and return to the editor.

Thank you!

Environment

Zed: v0.136.0 (Zed Preview)
OS: Linux 1.0.0
Memory: 31.1 GiB
Architecture: x86_64

If applicable, add mockups / screenshots to help explain present your vision of the feature

No response

If applicable, attach your ~/Library/Logs/Zed/Zed.log file to this issue.

No response

CharlesChen0823 commented 2 months ago

I found in Insert mode will be easy rename, but in Normal mode, need first type i to Insert mode, then will work.

ConradIrwin commented 2 months ago

This doesn't seem to be broken for me (though we did recently make some changes in this area).

Are there specific keystrokes or contexts that cause this for you?

kolunmi commented 2 months ago

@CharlesChen0823 That works! A little jank though

@ConradIrwin Hey, this problem happens at random from what I can tell, unless you press i first, as Charles noted. However, I'm on linux, Gnome 46 with the Jetbrains base keymap, if that is helpful. Can you replicate it now?

Thank you both!

0x2CA commented 2 months ago

This doesn't seem to be broken for me (though we did recently make some changes in this area).

Are there specific keystrokes or contexts that cause this for you?

hi,When I found this issues I tried it and it also reproduced, but it was only a one time reproduction and later it was normal again, unknown cause

Zed: v0.136.0 (Zed Preview)
OS: macOS 14.4.1
Memory: 32 GiB
Architecture: aarch64
msanft commented 1 month ago

It seems that the problem is that if you're in normal mode, and then try to rename a symbol, it will give you the illusion of being in insert mode (e.g. the cursor style), even though you aren't. I'd suggest that renaming a symbol should always bring you into insert mode, and when done renaming, you should be put back into whatever mode you've been in before.

ConradIrwin commented 1 month ago

@msanft are you on Mac or linux? Although I don't know why there would be a difference, it does seem like there is.

msanft commented 1 month ago

@msanft are you on Mac or linux? Although I don't know why there would be a difference, it does seem like there is.

I'm on Linux

eddiebergman commented 3 weeks ago

I found that remapping this in my vim keymap has made this very stable. Triggering this rename manually through the command pallete had the issues described above.

  {
    "context": "Editor && (vim_mode == normal || vim_mode == visual) && !VimWaiting && !menu",
    "bindings": {
      // put key-bindings here if you want them to work in normal & visual mode
      "R": "editor::Rename"
    }
  }

Using a keymap, I can hit R and then immediately start typing with expected behavior. I am even returned to normal mode after hitting enter