How to hide virtual_text when I open_float?

hello, guys
I want to display open_float when I move into the cursor,and display virtual_text when the cursor leave.

I set it up this autovim according to the wiki:

vim.cmd([[autocmd CursorHold,,CursorHoldI * lua vim.diagnostic.open_float(nil, {focus=false})]])

But I can’t make virtual_text work like I described above.


Can someone give me a hand.
Many thanks!

1 Like