folke / edgy.nvim

Easily create and manage predefined window layouts, bringing a new edge to your workflow
Apache License 2.0
840 stars 17 forks source link

fix: use %{%} expr to get window for winbar eval #55

Closed willothy closed 11 months ago

willothy commented 11 months ago

Solution to what #47 attempted. When using %{%} nvim temporarily sets the current window so we can make use of the api to ensure we're always getting the correct window instead of relying on a number passed in on creation.

This partially solves the dynamic title issue as well because people can just incorporate %!v:lua.edgy_winbar() into their own winbars without worrying about what window is being evaluated. It doesn't deal with the width issue though.

folke commented 11 months ago

ok, now I understand what you want to achieve.

Shouldn't it be local win = vim.g.statusline_winid instead though?

folke commented 11 months ago

Also, feel free to remove that adding of win as a parameter.

willothy commented 11 months ago

ok, now I understand what you want to achieve.

Shouldn't it be local win = vim.g.statusline_winid instead though?

Not sure, I'll try that! The temporary variables are a bit confusing to me (not sure when they're set and when they're not), get_current_win definitely works though.

willothy commented 11 months ago

Nope, g:statusline_winid seems to be nil

folke commented 11 months ago

I changed the code so that it no longer requires passing win.

willothy commented 11 months ago

Thanks!