eovim icon indicating copy to clipboard operation
eovim copied to clipboard

Tooltip support

Open yshui opened this issue 7 years ago • 2 comments

Add tooltip support to display information while hovering over some text.

yshui avatar Jan 17 '18 11:01 yshui

Mhh... let me try to rephrase, to see if I understood you correctly. Let say that you have a vim plugin that scans the current buffer for information. For example: finding an URL below the cursor. When the plugin does detect the URL, it wants the GUI client (Eovim) to trigger a widget at a given position (e.g. line+column) to make it contain additional information or controls (e.g. the widget could contain a button "Open"). Something like what is show there: https://fau.re/blog/20141019_terminology_gravatar.html.

That would indeed be a nice feature to have. Actually, you can already make it, but is would require some work, as you would need to implement an Eovim plugin.

If we take my previous example, upon detecting an URL under the cursor, the neovim plugin would run something like:

:call Eovim("tooltip", {'column': xx, 'line': yy, 'data': '...'})

Here data is a bit too generic, but I believe we can pass instead different keys:

  • text, taking a string with markup, to have rich text display,
  • run_command, which would generate a button with some explicative text (e.g. "Open URL") which upon being pressed would execute a command (e.g. xdg-open <url>).
  • ...

Please tell me this is somewhat what you had in mind, and I'll try to add a new Eovim plugin that implements a tooltip functionality.

jeanguyomarch avatar Jan 17 '18 11:01 jeanguyomarch

Yep, that's basically it.

I actually have an implementation of this for vanilla neovim: yshui/tooltip.nvim

yshui avatar Jan 17 '18 12:01 yshui