79236582

Date: 2024-11-29 09:56:32
Score: 0.5
Natty:
Report link

I find a way to mimic the mouse event to show the folded code. I write an autocmd this way :

local function on_mouse_hover()

 local winid = require("ufo").peekFoldedLinesUnderCursor()
   if not winid then
      vim.lsp.buf.hover()
   end
end

vim.api.nvim_create_autocmd("cursorHold", {
   pattern = "*",
   callback = on_mouse_hover,
   desc = "Action sur hover du curseur - vois le code repliƩ",
})enter code here

When you click the mouse on a folded block it will show you the preview. For that to work you need first to setup the plugin nvim-ufo.

If you dont click the mouse then it will show you the LSP documentation for the word under the mouse pointer. I use the plugin "eagle-nvim" for that.

Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: adminloozer