Xuyuanp/scrollbar.nvim

Change suggested autocommand

rcarriga opened this issue · 3 comments

Awesome work, this is a really cool plugin!

I just have a small suggestion for the README. Using BufEnter and BufLeave events means that when using the split and vsplit commands without any arguments, the bar doesn't update as the same buffer is used but in the new window. Replacing these with the WinEnter and WinLeave events fixes the issue.

Like I said just a minor thing, otherwise thanks a million!

Thanks for your suggestion!

Can you send a pr?

Also, all the autocmd events can be combined into the same lines which drastically reduces the number of lines in :h scrollbar-config like so:

augroup your_config_scrollbar_nvim
  autocmd!
  autocmd WinEnter,FocusGained,CursorMoved,VimResized * silent! lua require('scrollbar').show()
  autocmd WinLeave,FocusLost                          * silent! lua require('scrollbar').clear()
augroup end

Perhaps this should be updated in :help scrollbar-config as well?