zed icon indicating copy to clipboard operation
zed copied to clipboard

Vim mode: Difficulties attempting to rename a symbol

Open kolunmi opened this issue 9 months ago • 4 comments

Check for existing issues

  • [X] Completed

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

kolunmi avatar May 16 '24 01:05 kolunmi

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

CharlesChen0823 avatar May 16 '24 05:05 CharlesChen0823

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?

ConradIrwin avatar May 16 '24 16:05 ConradIrwin

@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!

kolunmi avatar May 17 '24 00:05 kolunmi

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

0x2CA avatar May 17 '24 01:05 0x2CA

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.

msanft avatar Jun 05 '24 08:06 msanft

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

ConradIrwin avatar Jun 06 '24 18:06 ConradIrwin

@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

msanft avatar Jun 07 '24 05:06 msanft

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

eddiebergman avatar Jun 21 '24 22:06 eddiebergman

This is now in today's preview release.

JosephTLyons avatar Jul 17 '24 20:07 JosephTLyons