Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add winbar support #689

Closed
wants to merge 3 commits into from
Closed

feat: add winbar support #689

wants to merge 3 commits into from

Conversation

diegodox
Copy link
Contributor

Support winbar added to nvim in this PR.

@shadmansaleh
Copy link
Member

shadmansaleh commented May 22, 2022

I'll wait on it and see first what winbar can best be used for . Also what ideas community can come up with for winbar . vim has had winbar for long time and tbh I've only noticed it to be used in vimspector.

For now I don't think using winbar just as a statusline is a good idea . I'll prefer to have winbar to be buffer specific unlike global . A winbar specific plugin can probably pull it of better than if just treat is as part of statusline in lualine.

So I'm putting it on hold . Not entirely rejecting it nor accepting the idea.

@diegodox
Copy link
Contributor Author

diegodox commented May 22, 2022

@shadmansaleh
I agree with you.
I implement this for me to try what I feel when use winbar as status bar. But I found #688, so I decided to create a PR for who interested in this.

btw I think winbar is a nice place to have information like nvim-gps, lsp-signature's statusline and lsp status.

@lkhphuc
Copy link

lkhphuc commented May 23, 2022

@diegodox exactly what I want. There is a lot of buffer specific info in my global statusline at the moment.
Just putting the file name > class > method > matchparen of the current cursor position is probably all I want for the winbar.

@diegodox
Copy link
Contributor Author

PS: I found winbar is only reasonable place to show filename of each buffer (especially inactive buffer) with global status line.

@rockyzhang24
Copy link
Contributor

rockyzhang24 commented May 23, 2022

The most useful points of winbar are:

  1. Full path of the filename (%F)
  2. LSP symbol path (aerial.nvim has API to output this)
  3. Window number (vim.api.nvim_win_get_number())

Setting them is very easy and no need further supports. I believe a fancy statusline is necessary but a plus fancy winbar at the top will be distracting. Also, a verbose and complicated winbar will get truncated and making it meaningless at all.

Screen Shot 2022-05-23 at 15 53 56

@bellini666
Copy link

Sorry for being totally off topic here guys...

But @rockyzhang24, do you mind sharing your font and color scheme from that screenshot?

@rockyzhang24
Copy link
Contributor

rockyzhang24 commented May 23, 2022

@bellini666 No problem.

do you mind sharing your font and color scheme from that screenshot?

Font: JetBrainsMono
Color scheme: nightfox.nvim and I configured some colors that are not easily distinguished (See this please if you need: https://github.com/rockyzhang24/dotfiles/blob/master/.config/nvim/lua/plugin/nightfox.lua)

@barrett-ruth
Copy link

Furthermore, with the creation of nvim-navic, I think the community has certainly made up it's mind about the utility of the winbar.

@alex-popov-tech
Copy link

imho statusline and winbar aim different purposes, statusline for more global things, which are shared across splits, and winbar are about some specific splint only
CleanShot 2022-06-14 at 22 23 24@2x

@joeveiga
Copy link

joeveiga commented Jun 14, 2022

@alex-popov-tech I think the ideal approach would be to be flexible enough for users to display whatever information they want on each. Like we do now with lualine sections, but having an extra set of section keys in the configuration for winbar sections. It already supports statusline and tabline this way, why not winbar as well?

In a perfect world users would be able to add lualine components and extensions currently used for statusline to the winbar, and vice-versa.

As you point out, a popular configuration could be winbar for buffer specific info and statusline for global/project level info. Another one could be, for example, statusline for the focused buffer (with a more detailed view) and winbar for inactive buffers. Someone might not care about diagnostic info on inactive buffers, while someone else might want to see which lsp clients are attached to each buffer instead of globally (for whatever reason).

@barrett-ruth
Copy link

barrett-ruth commented Jun 16, 2022

@diegodox I'd like to add that because you set the global winbar (vim.go instead of vim.wo) to winbar() it becomes difficult to disable lualine winbar on certain files in a different window. For example, disabling the winbar on NvimTree sidebar becomes basically impossible because setting vim.wo.winbar subsequently has no effect.

Sorry if this is bothersome but I know a lot of people will be bothered by there being an empty winbar essentially wasting space in a buffer.

shadmansaleh pushed a commit that referenced this pull request Jul 12, 2022
Pull in winbar changes form pr #689 and adapt them
Co-authored-by: shadmansaleh <13149513+shadmansaleh@users.noreply.github.com>
@shadmansaleh
Copy link
Member

@diegodox I've pulled the changed from this branch to #736 .

Would appreciate if you guys interested in the feature can test it.

@diegodox
Copy link
Contributor Author

diegodox commented Jul 12, 2022

@barrett-ruth Thank you for pointing out vim.go.winbar will not respect vim.wo.winbar. I'm planning to fix that (use vim.wo.winbar instead of vim.go.winbar). And sorry for late reply.
But sorry again, I have no time to impl that right now. Anyone who want to impl that feature are welcome. :)
I might find time in 1 month.

@diegodox
Copy link
Contributor Author

diegodox commented Jul 12, 2022

Need advice on implementation approach, is autocmd right choice to set winbar window option? or more simpler way exists?

@diegodox
Copy link
Contributor Author

@shadmansaleh I will look and test that branch, thank you.

@shadmansaleh
Copy link
Member

shadmansaleh commented Jul 15, 2022

Thank you for pointing out vim.go.winbar will not respect vim.wo.winbar. I'm planning to fix that (use vim.wo.winbar instead of vim.go.winbar). And sorry for late reply.
But sorry again, I have no time to impl that right now. Anyone who want to impl that feature are welcome. :)

addressing that issue is the purpose of #736 . So lualine can keep running even when options are unset.

shadmansaleh added a commit that referenced this pull request Jul 22, 2022
* feat: refresh lualine based on timer.

* fix config test

* fix lag on win change issue

* handle errors in timer callback

* feat: add winbar support

Pull in winbar changes form pr #689 and adapt them
Co-authored-by: shadmansaleh <13149513+shadmansaleh@users.noreply.github.com>

* make winbar disapear when winbar evals empty

* only update stl of curwin with globalstatus

* properly clear win local stl and wbr opts

* add version guards for winbar feature

* only add winbar if height > 1

* fix tests?

* refresh lualine on ModeChanged event

* ignore floating windows for refresh

* properply restore options to previous state

* fix stl not updating in cmd mode + some optimizations

* fix tests on <nvim-0.7

* merge status_dispatch & winbar_dispatch + winbar support for extensions

* fix globalstatus option not live updating

* update docs

* feat: allow disabling winbar and statusline separately

* fix tests

* fix: winbar some times oddly throwing errors

about not having space in floating windows.

This implements a temporary workaround the issue(neovim/neovim#19464)
until the bug in neovim gets fixed.

Co-authored-by: Diego Fujii <android.mxdiego9@gmail.com>
@shadmansaleh
Copy link
Member

shadmansaleh commented Jul 22, 2022

Merged with #736 in 53aa3d8

@diegodox diegodox deleted the winbar branch July 29, 2022 17:24
@diegodox diegodox restored the winbar branch August 4, 2022 08:54
craigmac pushed a commit to craigmac/lualine.nvim that referenced this pull request May 15, 2024
)

* feat: refresh lualine based on timer.

* fix config test

* fix lag on win change issue

* handle errors in timer callback

* feat: add winbar support

Pull in winbar changes form pr nvim-lualine#689 and adapt them
Co-authored-by: shadmansaleh <13149513+shadmansaleh@users.noreply.github.com>

* make winbar disapear when winbar evals empty

* only update stl of curwin with globalstatus

* properly clear win local stl and wbr opts

* add version guards for winbar feature

* only add winbar if height > 1

* fix tests?

* refresh lualine on ModeChanged event

* ignore floating windows for refresh

* properply restore options to previous state

* fix stl not updating in cmd mode + some optimizations

* fix tests on <nvim-0.7

* merge status_dispatch & winbar_dispatch + winbar support for extensions

* fix globalstatus option not live updating

* update docs

* feat: allow disabling winbar and statusline separately

* fix tests

* fix: winbar some times oddly throwing errors

about not having space in floating windows.

This implements a temporary workaround the issue(neovim/neovim#19464)
until the bug in neovim gets fixed.

Co-authored-by: Diego Fujii <android.mxdiego9@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants