Skip to content

Commit

Permalink
feat: use MouseMoved autocmd
Browse files Browse the repository at this point in the history
Makes use of neovim/neovim#23947
  • Loading branch information
willothy committed Jun 29, 2023
1 parent 7ec240f commit 6518711
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions lua/cokeline/hover.lua
Original file line number Diff line number Diff line change
Expand Up @@ -132,14 +132,12 @@ function M.setup()
return
end

vim.keymap.set({ "", "i" }, "<MouseMove>", function()
local ok, pos = pcall(vim.fn.getmousepos)
if not ok then
return
end
on_hover(pos)
return "<MouseMove>"
end, { expr = true })
vim.api.nvim_create_autocmd("MouseMoved", {
callback = function(ev)
on_hover(ev.data)
return "<MouseMove>"
end,
})
end

return M

0 comments on commit 6518711

Please sign in to comment.