nvim-lua / wishlist

A public catalogue of Lua plugins Neovim users would like to see exist
MIT License
235 stars 0 forks source link

Statusline #3

Closed clason closed 3 years ago

clason commented 4 years ago

What? A convenient and efficient way of configuring the statusline using lua (similar to airline or, in particular, lightline).

Why? A pure lua plugin would allow more efficient and, in particular, async routines for showing, e.g., git or lsp status.

Potential existing implementations: https://github.com/tjdevries/express_line.nvim (it's called "express line", it must be fast!)

*Potential pitfalls:* Ideally, it would tie in with other lua plugins (Git, LSP). Themability is an open question (could it directly support lightline color schemes)?

Seirdy commented 3 years ago

Also see https://github.com/glepnir/galaxyline.nvim

wbthomason commented 3 years ago

Maybe this can be considered "done" now? @tjdevries @glepnir do you think your implementations are complete per what @clason mentions?

matu3ba commented 3 years ago

Neither appears to support lsp with a meaningful simple/usable setup. Or they are too shy to mention in the README.

glepnir commented 3 years ago

@matu3ba hmm what do you mean? galaxyline has provide Lsp Diagnostic support. and you can write your custom provider to implement what you want

matu3ba commented 3 years ago

@glepnir I was thinking about some minimal default like lightline and colorscheme support. Sorry, keep forgetting that diagnostic handles the lsp output.

glepnir commented 3 years ago

Neither appears to support lsp with a meaningful simple/usable setup

like you said. galaxyline regards each area of ​​stautsline as a component, and provides a variety of keywords to provide settings, you can set the color you want for each area. Instead of using some fixed theme colors. galaxyline is a statusline plugin that supports full customization. Its purpose is that users can build their own statusline through their own ideas. For the convenience of users who have no experience in neovim, I have written some default functions, which can realize a statusline by simply calling

matu3ba commented 3 years ago

@glepnir Only drawback I see is missing support of various colorschemes in lua like onehalf or do you know fairly complete ones in lua?

glepnir commented 3 years ago

check here ,config colorscheme is not difficult.

ishan9299 commented 3 years ago

@matu3ba my colorscheme modus-theme-vim has support for galaxyline.

coxackie commented 3 years ago

What about lualine? I am quite excited about this one...

glepnir commented 3 years ago

@coxackie Lualine looks more like airline. It is heavy, galaxyline is more free and light. galaxyline allows you to completely customize any area of ​​the statusline. check here to see users custom statusline.

coxackie commented 3 years ago

@glepnir I would not really call it "heavy", to be honest. It is lighter than lightline, at least it feels so, and there are also some metrics by the author. It is true though that it offers more out of the box experience than galaxyline. I would not compare the two directly, but there seems to be space for both to co-exist.

glepnir commented 3 years ago

@coxackie You can check our conversation in the reddit post to understand the difference

@clason There were some discussions that were disconnected from the subject. So is it possible to close the issue with lock

coxackie commented 3 years ago

@glepnir as far as I can see from the reddit post, you agree with what I mentioned above. I am also not sure what is meant by "discussions that were disconnected from the subject". Do you mean my reference to lualine? Can you be more specific? I do not see any comment above that is out of topic, really.

hoob3rt commented 3 years ago

I don't know what you mean by "heavy". I consider something heavy in vim when it slows it down, not when it's a few kb bigger in size. FYI here is startup time performance of a few plugins. I was surprised that galaxyline was slower than vimscript plugins.

galaxyline.nvim.git 5.791   
vim-airline.git         3.896   
lightline.vim.git   2.171   

While lualine loads in 0.1ms as seen in lualine repo

glepnir commented 3 years ago

your benchmark is in interest ing. I already test it startuptime is 0. 5

glepnir commented 3 years ago

you need use lua profile to test it.

hoob3rt commented 3 years ago

Could you provide a way to use lua profile inside neovim?

glepnir commented 3 years ago

It is in our plan. I will push my test bench mark scripts when i have time

hoob3rt commented 3 years ago

Okay, thank you :)

glepnir commented 3 years ago

@hoob3rt your benchmark has some problem. check this profiler . image

Looking at the profiler, you can see that the core loading time of galaxyline is only 0.0014ms, and the other time is spent on some providers, most of which is diagnostic. The built-in galaxyline provides diagnostic support for nvim lsp and some other functional support, galaxyline does not depend on Many plug-ins, so in order to enable more users who do not understand lua and vimapi to easily define their own status bar, I wrote many providers. If you remove all of their functions and implement them yourself.

when I only remove diagnostic providers ,profile galaxyline with other providers . Other providers may not consume as much startup time as diagnostic, but I implemented a builtin function for obtaining git branches. It does not depend on git commands or plugins. It is a complex provider. Even so, galaxyline takes about the same time as lualine. image

Only load the core of galaxyline, which has only about 200 lines of code. Then it will be super fast. But this raises the requirements for users. I will not do this, I hope to provide builtin support instead of depend on any plug-ins

image

Looking at lualine. yes.It seems that there is little time. Looking at the code, lualine provides support through the use of many plug-ins. The default code is very simple. Maybe it is a wrong view to say that it is heavy. But I don't like this approach of relying on plugins. But out of the box is great for some people who don't pursue too much.

Finally, I want to talk about my conclusion, if remove the built-in providers, galaxyline is the fastest, lualine it is a good choice for the out-of-the-box statusline plugin . With reference to this diagnostic, I will implement a more efficient diagnostic on upstream of neovim. Out of the box instead of packaging at the plugin level, it will be very useful for any statusline plugin.

Update 2021-2-4

Now galaxyline async load all the provides This reduces some providers that take special startup time, such as diagnostic providers,

image

hoob3rt commented 3 years ago

@hoob3rt your benchmark has some problem. check this profiler .

Thank you so much for answering! I will test this profiler myself as well.

Looking at the profiler, you can see that the core loading time of galaxyline is only 0.0014ms, and the other time is spent on some providers, most of which is diagnostic.

I understand that galaxyline's core is really fast but the total loadtime includes diagnostic bottleneck.

Only load the core of galaxyline, which has only about 200 lines of code. Then it will be super fast. But this raises the requirements for users. I will not do this, I hope to provide builtin support instead of depend on any plug-ins

I wouldn't say lualine depends on any plugins, just extends their functionality if the user wants to.

Maybe it is a wrong view to say that it is heavy.

I'm glad you finally agreed :)

With reference to this diagnostic, I will implement a more efficient diagnostic on upstream of neovim. Out of the box instead of packaging at the plugin level, it will be very useful for any statusline plugin.

That's awesome! I would be very grateful if you could tag me when this is implemented. :)

Thank you once again for your detailed reply.

clason commented 3 years ago

And with that, might I suggest we keep the "my statusline is faster than yours" out of this issue? It's enough to introduce your statusline plugin here and (briefly) point out what you think are the strengths; people can come to their own conclusion which tradeoffs they want to make. No reason to make a competition out of it.

(And to the extent that this is "my" issue, I'll only close it once I have found a plugin that I start using myself. This has not happened yet.)

beauwilliams commented 3 years ago

I am currently working on a lua statusline. Want it to be fast and minimal config. If anyone wants to join in or take a look would be much appreciated. This is first time for me trying to write an extension as exercise in writing lua. There is a lot of work to be done, and its nothing special right now :) https://github.com/beauwilliams/statusline.lua

beauwilliams commented 3 years ago

I have done a fair amount of work to refactor and clean the codebase up for statusline.lua

Let me know what you guys think. I want this to be light, dependency-free-as-possible and little effort to configure if any. https://github.com/beauwilliams/statusline.lua

shadmansaleh commented 3 years ago

With all these statuslines how come this isn't granted yet ?

matu3ba commented 3 years ago

With all these statuslines how come this isn't granted yet ?

async routines for showing, e.g., git or lsp status.

@clason Can you specify exactly what you want in your statusline?

famiu commented 3 years ago

Give feline a try. It's not async but it allows you to easily configure your own statusline.

windwp commented 3 years ago

@clason https://github.com/windwp/windline.nvim my statusline can change status by filetype

clason commented 3 years ago

I think that's enough Lua status lines for now ;)

clason commented 3 years ago

For the record, in the end I went for https://github.com/shadmansaleh/lualine.nvim. The main draw for me was the clean configuration in Lua.