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

set statuscolumn #100

Open
mehalter opened this issue Jan 10, 2023 · 14 comments
Open

set statuscolumn #100

mehalter opened this issue Jan 10, 2023 · 14 comments

Comments

@mehalter
Copy link
Contributor

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
Copy link
Owner

rebelot commented Jan 10, 2023

I am working on it :)

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

@mehalter
Copy link
Contributor Author

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

@rebelot
Copy link
Owner

rebelot commented Jan 10, 2023

7b57b27

@mehalter
Copy link
Contributor Author

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
Copy link
Contributor Author

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

@olimorris
Copy link
Contributor

@mehalter stunning work!

@mehalter
Copy link
Contributor Author

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
Copy link
Owner

rebelot commented Feb 20, 2023

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 mehalter reopened this Feb 20, 2023
@mehalter
Copy link
Contributor Author

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
Copy link

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
Copy link
Contributor Author

mehalter commented Aug 22, 2023

@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
Copy link

@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
Copy link

richin13 commented Dec 6, 2023

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

@mehalter
Copy link
Contributor Author

mehalter commented Dec 7, 2023

@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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants