barbar.nvim icon indicating copy to clipboard operation
barbar.nvim copied to clipboard

Request : Rounded left and right separators

Open paradoxsupreme opened this issue 3 years ago • 12 comments

It would be nice if it had support for powerline rounded separators between buffers.

paradoxsupreme avatar Nov 04 '20 20:11 paradoxsupreme

It's currently using this for icons:

let icons = extend({
\ 'bufferline_default_file': '',
\ 'bufferline_separator_active':   '▎',
\ 'bufferline_separator_inactive': '▎',
\ 'bufferline_close_tab': '',
\ 'bufferline_close_tab_modified': '●',
\}, get(g:, 'icons', {})) " 

However this is undocumented and therefore not supported currently. I haven't decided yet how to expose that but I guess it should rather be on the g:bufferline dict rather than on a separate g:icons dict. But I think it won't work for powerline separator because those one require logic to gather th fg/bg from the item after/before.

romgrk avatar Nov 04 '20 21:11 romgrk

Did you have an example of how you'd want it to look? I've been checking the powerline separators and I don't feel that any of them would have an aesthetically pleasing result. I would maybe add a separator for #22, but for the moment I'm not inclined to add powerline separator in-between tabs. The infrastructure to do it is however in-place as I had to make a refactor for scrollable tabs, so I would accept a PR that doesn't increase complexity by too much.

romgrk avatar Nov 07 '20 09:11 romgrk

Maybe he meant something like this (notice the statusline).

hewcaw avatar Nov 07 '20 16:11 hewcaw

Did you have an example of how you'd want it to look? I've been checking the powerline separators and I don't feel that any of them would have an aesthetically pleasing result. I would maybe add a separator for #22, but for the moment I'm not inclined to add powerline separator in-between tabs. The infrastructure to do it is however in-place as I had to make a refactor for scrollable tabs, so I would accept a PR that doesn't increase complexity by too much.

Maybe he meant something like this (notice the statusline).

Yes that's exactly what I want. The unicode characters for rounded powerline separators are U+E0B6 and U+E0B4. So what I had in mind was to use U+E0B6 at the start of tabline and then to separate tabs with the U+E0B4 separator.

paradoxsupreme avatar Nov 07 '20 18:11 paradoxsupreme

That screenshot does look nice, but it doesn't match exactly what you're describing. What you describe sounds like this:

Screenshot from 2020-11-08 03-07-00

And I'm still not convinced. I'm open to making things look nice, but I'd need detailed (and nice looking) diagrams. You can build an example with the terminal, eg:

export bg1=243 &&
export fg1=255 &&
echo -e "\x1b[38;5;${bg1}m\ue0b6\x1b[0;48;5;${bg1};38;5;${fg1}mtab 1\x1b[0;38;5;${bg1}m\ue0b4"

(refer to https://github.com/guns/xterm-color-table.vim for colors)

romgrk avatar Nov 08 '20 08:11 romgrk

That screenshot does look nice, but it doesn't match exactly what you're describing. What you describe sounds like this:

Screenshot from 2020-11-08 03-07-00

And I'm still not convinced. I'm open to making things look nice, but I'd need detailed (and nice looking) diagrams. You can build an example with the terminal, eg:

export bg1=243 &&
export fg1=255 &&
echo -e "\x1b[38;5;${bg1}m\ue0b6\x1b[0;48;5;${bg1};38;5;${fg1}mtab 1\x1b[0;38;5;${bg1}m\ue0b4"

(refer to https://github.com/guns/xterm-color-table.vim for colors)

The screenshot you posted describes what I had in mind. Maybe you can add the option to customize the highlights of the background of the active and inactive tabs so somebody can tweak it to make it look nicer.

paradoxsupreme avatar Nov 08 '20 15:11 paradoxsupreme

Sorry I still don't see it being beautiful, so I won't invest time in it :/ If anyone is interested and thinks they can make it look nice, I accept PRs.

romgrk avatar Nov 09 '20 01:11 romgrk

@paradoxsupreme there's now an API for customizing icons. I suspect it will take some work to set up the highlight groups and icons but it should technically be possible now

See the linked PR above this comment for more info, as well as the :help page which outlines how to change the icons

Iron-E avatar Dec 01 '20 17:12 Iron-E

@paradoxsupreme there's now an API for customizing icons. I suspect it will take some work to set up the highlight groups and icons but it should technically be possible now

See the linked PR above this comment for more info, as well as the :help page which outlines how to change the icons

Nice ! good job man thanks. I will try it out!

paradoxsupreme avatar Dec 01 '20 18:12 paradoxsupreme

Though I don't think it will be enough to reproduce the screenshot above

romgrk avatar Dec 01 '20 21:12 romgrk

After trying for some time I think you might be right. The closing icons would need their own highlight group in order to make it look right with respect to the background.

In case anyone is interested, that change would be made in render.lua on line 171. Probably something like:

closePrefix = namePrefix .. 'Close'

Defaults for these groups would also need to be added in autoload/bufferline/highlight.vim

Iron-E avatar Dec 01 '20 21:12 Iron-E

Sorry I still don't see it being beautiful, so I won't invest time in it :/ If anyone is interested and thinks they can make it look nice, I accept PRs.

I think what he wants is like this (ignore the text):

image

xtrats avatar Feb 14 '22 12:02 xtrats

Hi, I think this would be possible, if we added an option for different left and right separators, then we can easily pad in the glyphs and make it rounded. I think this would be fairly trivial and would allow for a high degree of customization. I know this issue had been dead for a long time. But if you're accepting PRs for this I would be happy to work on it!

xinslu avatar Jan 22 '23 20:01 xinslu

@xinslu we'd be glad to have you work on this! You're right, it doesn't seem undoable, there just hasn't been interest in pushing it forward thus far. Feel free to open a PR

Iron-E avatar Jan 22 '23 22:01 Iron-E

#386 adds the ability to specify left and right separators:

barbar

(The config in the image: here and here)

You can try it, but there may yet be changes before the final release. If you do, feel free to leave feedback.

Expect to tweak the default hl groups, since rounded/slanted characters have weird interactions compared to how normal characters get highlighted. Just type :hi Buffer and hit your wildchar (see :h 'wildchar' or :lua = string.char(vim.opt.wildchar:get())) to look at the options available.

Iron-E avatar Mar 24 '23 21:03 Iron-E

@Iron-E I was looking to create exactly this look, but was missing option for right separator. It would be very nice if we get this.

oredaze avatar Mar 25 '23 18:03 oredaze

For those still watching this issue, see :h barbar-setup.icons.separator in the latest master.

Iron-E avatar Mar 30 '23 00:03 Iron-E

how to remove the highlight of this tab? image

JennytheDragon2000 avatar Jun 13 '23 01:06 JennytheDragon2000

how to remove the highlight of this tab? image

Are you using the preset feature? Either way, look at the README and try using the information there (we have detailed info on all the highlight groups)

Iron-E avatar Jun 13 '23 18:06 Iron-E