lewis6991 / satellite.nvim

Decorate scrollbar for Neovim
MIT License
542 stars 20 forks source link

Expose enable / disable Lua interface #12

Open spywhere opened 2 years ago

spywhere commented 2 years ago

Is your feature request related to a problem? Please describe. No

Describe the solution you'd like Expose enable and disable to the Lua interface for better Lua integration

Describe alternatives you've considered I could use a function to call vim.cmd('SatelliteEnable') (or disable), but those Lua interface would be nice

Additional context Mind that if it get implemented, both calls could be run before setup. So a call guard might be needed to prevent unexpected behavior.

lewis6991 commented 2 years ago

Do you have valid use cases to why you want an API for this? Asking for things without any justification other than "it would be nice" doesn't really fly.

spywhere commented 2 years ago

Asking for things without any justification other than "it would be nice" doesn't really fly

Fair point. My use case was to plug the enable/disable function into my callback directly without a need to use vim.cmd.

Here's the code in my dotfiles that would be benefit by using a lua interface: https://github.com/spywhere/dotfiles/blob/de33a0b0a700b01a57b406db92dc3be57a057a8b/configs/nvim/lua/plugin/appearance/satellite.lua#L40

lewis6991 commented 2 years ago

It looks like what you actually want is:

require('satellite').setup {
  current_only = true,
}
spywhere commented 2 years ago

No, that piece of code was to show the scrollbar for a certain amount of time before hiding it, then show it again once I moved the cursor or scroll the window (or etc.).