rebelot / heirline.nvim

Heirline.nvim is a no-nonsense Neovim Statusline plugin designed around recursive inheritance to be exceptionally fast and versatile.
MIT License
1.02k stars 40 forks source link

set `statuscolumn` #100

Open mehalter opened 1 year ago

mehalter commented 1 year ago

With heirline being able to be used for tabline, winbar, and statusline. Would we be able to use it for the new statuscolumn option that's coming in Neovim v0.9? Heirline's API would make it very easy to make a good looking status column with clickable actions

Also as these similar options are added the number of parameters in the .setup({...}) table are growing a lot. Would it make sense to move to a single table parameter where the first key is the option you are setting? like instead of

require'heirline'.setup(statusline, winbar, tabline)

it could look like this:

require("heirline").setup {
  statusline = statusline,
  winbar = winbar,
  tabline = tabline,
  statuscolumn = statuscolumn,
}

then it's easy to add and remove new options that heirline can set

rebelot commented 1 year ago

I am working on it :)

and yes, that is how config will be passed to heirline.

mehalter commented 1 year ago

Beautiful! Thank you so much for all your hard work!

rebelot commented 1 year ago

https://github.com/rebelot/heirline.nvim/commit/7b57b27e9e4d1ffa4f3e149f8fdc927db18a850a

mehalter commented 1 year ago

Works great! One thing I am wondering, I noticed when I get the arguments from the callback for on_click, I'm not getting the mods variable. Is this something that needs to be added or maybe I'm just being silly.

Also if you are interested, this is the statuscolumn that I'm currently using: https://code.mehalter.com/AstroNvim_user/~files/v3/plugins/heirline.lua

mehalter commented 1 year ago

ah I found it @rebelot , I'll open a PR

olimorris commented 1 year ago

@mehalter stunning work!

mehalter commented 1 year ago

I just noticed that this issue is still open! I think this is more than resolved and I've been using the statuscolumn support for a while now and have had absolutely no issues. Thanks again @rebelot for your help here getting this added! Heirline continues to be the best :D

rebelot commented 1 year ago

I was waiting to close this until I added some snippets in the cookbook.. but I didn't have much time to tinker with it seriously.. I wanted to implement some sort of buf/win cache to store arbitrary data. Also I was trying to customize the sign/fold columns but I gave up as it feels buggy enough to not be worth it

mehalter commented 1 year ago

Ah sorry about that @rebelot ! I can take some time in the coming days/week to make a PR with some snippets. I have gotten fold indicators working quite nicely by exposing some C based fold APIs with Lua ffi

willothy commented 1 year ago

Working on my Heirline statuscol right now (that's why I wanted to add #165), I'd be happy to contribute some snippets as well :)

Also @mehalter, mind linking that fold FFI code if you still have it?

mehalter commented 1 year ago

@willothy Sure! Sorry I haven't had time to get around to this yet. Life has been super busy 😅 Here is the code I've been using for a while, it is part of a pretty large API for building lines/bars in Heirline where functions return pieces of Heirline components, so it looks a bit different than if you just wanted to implement these components directly. But it can definitely be used as a reference:

Lua FFI code for fold API: https://github.com/AstroNvim/AstroNvim/blob/main/lua/astronvim/utils/ffi.lua

Links to the usage of this to build a foldcolumn component:

willothy commented 1 year ago

@willothy Sure! Sorry I haven't had time to get around to this yet. Life has been super busy 😅 Here is the code I've been using for a while, it is part of a pretty large API for building lines/bars in Heirline where functions return pieces of Heirline components, so it looks a bit different than if you just wanted to implement these components directly. But it can definitely be used as a reference:

Thanks! Appreciate the links. I'll open up a PR with some docs once I've got my statuscol polished.

richin13 commented 10 months ago

Can anyone post some screenshots of how their statuscolumn looks like? Looking for inspiration / ideas 👀

mehalter commented 10 months ago

@richin13 here is the statuscolumn we use over in AstroNvim that is all Heirline based with click actions for folds/diagnostics/gitsigns/DAP, full support for vim option control like vim.opt.signcolumn/vim.opt.number/etc., as well as lazy loading and catching for peak refresh performance

The code is definitely a bit complicated and uses a fully custom Lua API we have for building Heirline components. But we use it to create our custom statusline, statuscolumn, winbar, and tabline

2023-04-07_085149_screenshot.png