echasnovski / mini.nvim

Library of 40+ independent Lua modules improving overall Neovim (version 0.8 and higher) experience with minimal effort
MIT License
4.74k stars 179 forks source link

mini.tabline: Add marker to tabs that have been modified. #824

Closed DzedCPT closed 4 months ago

DzedCPT commented 4 months ago

Contributing guidelines

Module(s)

mini.tabline

Description

I find it helpful when edited tabs include a marker in their file name to signify that the tab has been modified. I know that mini.tabline changes the highlight group but I often miss this and find having the marker very useful to avoid running code before saving changes. I've implemented it locally so that modified files have a little + suffix and it looks like this, if for example init.lua has been modified:

Screenshot 2024-04-19 at 19 44 13

My suggestion is to make it configurable (ie you can pick the modified marker) and make the default be the current behaviour (ie the modified marker is the empty string "").

I'd be happy to upstream these changes but I'd like to first know if this is a feature people are open to or not?

echasnovski commented 4 months ago

Thanks for the suggestion!

Yes, the primary way of how 'mini.tabline' shows modified files is with MiniTablineModifiedXxx highlight groups. And in the spirit of trying to have tabline as narrow as possible, I don't think adding duplicating marker is a good design.

My suggestion is to ensure that "modified" highlight groups are very visible. Like, for example, 'mini.hues' has them inverted compared to not-modified tab.

Closing as not planned.

DzedCPT commented 4 months ago

Thanks for the thorough response.

A couple of points

  1. I don't want to fiddle with highlight groups because it can make changing themes a pain, plus I don't want things to get too colourful.
  2. Also, a '+' is a standard vim way to mark a buffer as edited and unsaved as this is what the default status line does, whereas with colours it's harder to remember what each colour combination means (ie is it a modified tab or the current tab?). Plus you have to relearn what the colours mean each time you change the theme.

All of that being said, I don't mean to force this, I'm happy to keep these changes local, and I understand that having multiple ways to indicate the same thing isn't necessarily the cleanest (or dare I say mini-iest) way of doing it.

pkazmier commented 4 months ago

I, too, wanted some marker initially, but that's because I never thought about inverting the colors as @echasnovski does in mini.hues. Sample screenshot below, which I think makes it easy to see the three modified buffers:

image

mini.hues has quickly become my favorite color scheme due to the balance of perceptual brightness.

echasnovski commented 3 months ago

@DzedCPT, although I still recommend using colors to indicate modified buffers, a more general label customization is now possible with config.format. The help page has the example of how to add "+" suffix for modified buffers.

DzedCPT commented 2 months ago

Very cool, thanks for letting me know 😀