zed icon indicating copy to clipboard operation
zed copied to clipboard

Vim: ghh Moves the vim curser into popup menu

Open NukaCody opened this issue 1 year ago • 4 comments

Check for existing issues

  • [X] Completed

Describe the feature

Allow ghh (double h) to move the vim cursor into the pop up menu displaying documentation or errors, allowing you to copy examples, error messages, etc. Then press q to close the pop up message.

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

No response

NukaCody avatar Feb 02 '24 15:02 NukaCody

I'd love to give this a try over the weekend if I could get some high level direction on how to achieve this (or a similar commit)

NukaCody avatar Feb 02 '24 15:02 NukaCody

cc @ConradIrwin for some Vim examples

JosephTLyons avatar Feb 02 '24 19:02 JosephTLyons

Doing some research into this, tell me where I'm wrong:

  • Vim delegates to Editor or other crates for functionality
  • Editor has popups here
  • Popups render a "div" by delegating to gpui here

The main issue is that this div does not have any interactivity to the same level of a editor itself or at least an "editor-lite". Ideally there'd be an editor command like "FocusPopover" that would move the cursor into the popover and subsequent q to move to the previous focus (I think that's how it works).

So I think it'd have to be:

  • Implement interactivity in popovers first (As of now you can't highlight text even with a mouse)
    • This one is probably the trickiest and where I'm struggling with where to start as the popover looks to be a readonly static render of data queried from the LSP, not like a "editor lite"
  • Implement a "FocusPopover" command or maybe "TogglePopoverFocus"?
  • Implement a Vim binding that would call this command

NukaCody avatar Feb 03 '24 04:02 NukaCody

@NukaCody youre exactly right. I know @mikayla-maki had some ideas for making text in gpui selectable, but I don’t think that’s happened yet.

probably the easiest path forward would be an action to either copy the text in the popup, or open it in a new buffer/split.

ConradIrwin avatar Feb 03 '24 05:02 ConradIrwin