chentoast/marks.nvim

Method 'refresh' breaks CursorHold

rodamaral opened this issue · 8 comments

This plugin is making my CursorHold autocmds never execute.

For example:

autocmd CursorHold <buffer> lua print'CursorHold'

This seems to happen due to M.refresh being called before my updatetime expires and then reseting the hold timer.
https://github.com/chentau/marks.nvim/blob/f43e349601b439b4b07bec1d996cfd70d48d09fb/lua/marks/init.lua#L68

One option would be to set ‘refresh_interval’ to some very high value so it won’t interfere, and the set up your own custom mark redraw logic on CursorHold. I’m traveling now but will post a snippet when I can

I was wondering why my autosave suddenly stopped working.

Can we switch to event autocmd WinScrolled to call refresh.
I don't think the marks sign need update too offten
@chentau

WinScrolled is not enough. For things like mark preview, and extracting marks to loc/quickfix lists, we need the mark state to be synchronized even if they are not visible on screen. In addition, WinScrolled is not fired when switching buffers, which may happen when moving to bookmarks or capital marks.

Here's the workaround that I promised but never got around to posting:

lua <<EOF
require'marks'.setup {
  refresh_interval = 0 -- or some really large value to disable mark tracking
}
EOF

au CursorHold * lua require'marks'.refresh()

Note that whatever autocmd you choose is up to you; you can use WinScrolled instead if you want, for example.

Ok i will do your solution to disable refresh.
i notice your plugin force my status line redraw even i don't typing any key on normal mode.

FYI there has been a potential fix pushed to latest Neovim master. Would be great if people test this on latest HEAD to see if the issue still persists.

I'm thinking of switching over to cursorhold as default in the next couple of weeks, but I don't want to break anyone's configuration. Does anyone have a timer-based approach or usage of the plugin that would not work with a cursorhold based refresh approach?