lewis6991 / gitsigns.nvim

Git integration for buffers
MIT License
5.11k stars 196 forks source link

FS events instead of polling #598

Closed will closed 1 year ago

will commented 2 years ago

Do you think it'd be both A) possible and B) worth it to use https://github.com/luvit/luv/blob/master/docs.md#uv_fs_event_t--fs-event-handle instead of polling the git directory for changes?

The libuv bindings all works for me on macOS, haven't tried on a linux yet, but the docs seem to say that they make it work for every platform

local fse = vim.loop.new_fs_event()
local path = vim.fn.expand("%:p")

vim.loop.fs_event_start(fse, path, {}, function(err, filename, events)
  vim.notify(vim.inspect(err) .. vim.inspect(filename) .. vim.inspect(events))
end)
lewis6991 commented 2 years ago

I initially tried fs events, however I found they were causing 100% CPU utilisation on my Mac.

This was over a year a go so libuv may have fixed this issue by now, but will need to check.

will commented 1 year ago

Oooo exciting :)