romgrk / barbar.nvim

The neovim tabline plugin.
2.2k stars 81 forks source link

Lazy init hindered? #415

Closed ttytm closed 1 year ago

ttytm commented 1 year ago

Doesn't the current solution of calling the setup if the user didn't already initiated the plugin make it hardly possible to lazy load the plugin?

Why not go the common way to require the user to call setup() for a plugin to be initiated.

Iron-E commented 1 year ago

This will be how it is done in v2; it has to be done this way to preserve backwards compatibility with earlier versions of this plugin. If you want to see how I get around it, see my config (I think packer can do it too with opt = true)

Iron-E commented 1 year ago

See #394

ttytm commented 1 year ago

Thanks for the info I had check this issue. It wasn't clear from it that calling setup will be required and auto setup will be removed.

Iron-E commented 1 year ago

Thanks for the info I had check this issue. It wasn't clear from it that calling setup will be required and auto setup will be removed.

I'll update the text to be more clear

ttytm commented 1 year ago

And thanks alot for the share of the code! Gave me the missing hint to make it work for the way my config is organized. The tabline was still flashing when entering on a dashboard with my attempts before, despite the showtabline setting 🙏.

romgrk commented 1 year ago

Why not go the common way to require the user to call setup() for a plugin to be initiated.

I actually don't like forcing users to call setup. It's bad UX, this plugin should work with as less hassle as possible for the user. They've already installed us in their config, why wouldn't they want to enable us? Package managers already have the logic to enable on command, I'd leave the problem to them. Also we're a bufferline plugin, we kinda need to be displayed asap, lazy loading doesn't make much sense for us.

ttytm commented 1 year ago

I can only speak for my config. On a dashboard buffer I hide the bufferline. And when I launch a neovim instance (not on netrw) it starts on a dashboard, which is a bit troublesome atm with barbar.

With lazy.nvim calling the default setup() is as easy as adding config = true next to the repo. I prefer the convention not having setup() called for me and consider it better UX(at least for neovim users :P) to leave that choice to them.

Iron-E commented 1 year ago

I also delay loading, until the second buflisted buffer opens, which sometimes doesn't happen for short editing sessions. Calling setup twice can make init take longer too.

If you'd prefer to keep it though, I can leave it unticked on the breaking change todo list. I'm alright with that too, it has it's upsides as well