tamton-aquib / staline.nvim

A modern lightweight statusline and bufferline plugin for neovim in lua.
MIT License
373 stars 16 forks source link

Set icons/symbols colors separately #67

Open gldtn opened 4 months ago

gldtn commented 4 months ago

Is it possible to set a default fg = "color" and set icon/symbol to a different color? For example in lualine, the fg, sets the color for each section and you can additionally set icon = { fg = "color", bg = "color" }.

Thanks!

gldtn commented 4 months ago

I did a little more digging and was able to get staline to look almost 100% the way I would like, but for that I had to modify your code. I would attempt to do a PR, but I barely know what I'm doing here 😆

Screenshot: staline

For the file icon, I had to modify the file_name line in staline.lua, by separating file icon to its own line and removing the extra space from the left of the icon itself:

 M.sections['file_icon']        = "" .. f_icon .. " "
 M.sections['file_name']        = " " .. f_name .. edited .. ""

After modifying it I was able to do something like:

sections = {
        left = {
          { 'GoldSep',     'left_sep' },
          { 'Gold',        'mode' },
          { 'GoldSep',     'right_sep' },
          { 'LoveIconSep', 'left_sep' },
          { 'LoveIcon',    'file_icon' },
          { 'Love',        'file_name' },
          { 'LoveSep',     'right_sep' },
          'branch', 'diagnostics',
        },
        mid = {},
        right = {
          'lsp_name', ' ',
          { 'FoamIconSep', 'left_sep' },
          { 'FoamIcon', ' ' },
          { 'Foam', ' %l:%L' },
          { 'FoamSep', 'right_sep' },
          { 'GoldIconSep', 'left_sep' },
          { 'GoldIcon', ' ' },
          { 'Gold', ' %p%%' },
          { 'GoldSep', 'right_sep' },
        }
      },

I think by allowing to pull the icons separately on predefined sections it gives us more flexibility, I didn't attempt to do the mode_icons separate from mode_names as that is above my capabilities :/, but that would be a nice touch if it's something that is not implemented yet.

I also had to modify the lsp client names a bit to hind the #'s of clients count and the ( ) around it, if possible can you set an option for maybe lsp_clients_count = false?

Sorry for all the requests, and thank you for the awesome plugin!

tamton-aquib commented 4 months ago

Heyyo @gldtn,

These are excellent proposals. Some of them should have been like that from the beginning but i was not experienced back then to design it in a clean way 😅 .


About the file components, changing file_name to something else might be a breaking change for other users. How about if we have other components like f_name, f_icon and f_modified? file_name can stay unchanged which is a combination of the previous three. What do you think?


About mode_names, is it really necessary since we could edit mode_icons to have the names, for example:

require("staline").setup({
    mode_icons = {
        n = "[icon] NORMAL",
        i = "[icon] INSERT",
        -- etc...
    }
})

About the lsp client name part, I'm not too sure about how it is implemented since it was merged from a PR. I'll check and report back.

gldtn commented 4 months ago

About the file components, changing file_name to something else might be a breaking change for other users. How about if we have other components like f_name, f_icon and f_modified? file_name can stay unchanged which is a combination of the previous three. What do you think?

That would be perfect.

About mode_names, is it really necessary since we could edit mode_icons to have the names, for example:

I was giving this one a thought, and tried playing with it a bit, but if I want to match the rest of the others sections like in my screenshot above, an it seems like I can't separate the icon from the name, or have different BGs for each. Would it be somewhat easy to implement a component called mode_names so it retrieves the name of the modes? If it's not too much of a headache of course.

About the lsp client name part, I'm not too sure about how it is implemented since it was merged from a PR. I'll check and report back.

Awesome, IMO the #'s of cliente and the (), it makes it look a bit cluttered or just "out of place"

These are excellent proposals. Some of them should have been like that from the beginning but i was not experienced back then to design it in a clean way 😅 .

I'm trying to learn a bit as I go myself! I've been using nvim for less than a year, barely new how to move around and here am I fiddling around plugin codes 😓. When I seen that you mentioned @vhyrro in the readme, I had to check the plugin out, his videos has been life changing to my nvim journey.

Thanks once again for creating this and taking you time to reply!

tamton-aquib commented 4 months ago

That would be perfect.

I'll start adding those then.

others sections like in my screenshot above, an it seems like I can't separate the icon from the name, or have different BGs for each.

Hmm yes that makes sense

Awesome, IMO the #'s of client and the (), it makes it look a bit cluttered or just "out of place"

Agreed, customizing components should be given to the users.

So I'll start with the first one right now. The second and third issue might need some thoughts.

When I seen that you mentioned @vhyrro in the readme, I had to check the plugin out, his videos has been life changing to my nvim journey.

Great dude, i have known him for nearly 4 years. He has taught me a lot from his discord server.

gldtn commented 4 months ago

Hey, you might be still working on it, but testing out your recent commit, I see that you added f_icon_hl, can that be modified from the config? Adding a highlight.. { 'LoveIcon', 'f_icon' } doesn't seem to do the trick.

Thanks for the modifications.

tamton-aquib commented 4 months ago

f_icon actually respects the setup.defaults.true_colors option. Maybe I should remove that part 🤔

gldtn commented 4 months ago

If there is no other way to override the highlight explicitly in the config perhaps for the granular option it would make since to remove it?

tamton-aquib commented 4 months ago

But users might want the highlight from nvim-web-devicon plugin 🤔 .

But I will take it off for now. Also for other issues, it might take some more time (Or if you come up with something and send a pr, thats fine too!)

gldtn commented 4 months ago

Thank you for implementing this. If I come up with any ideas I'll send a pr.