b0o / incline.nvim

🎈 Floating statuslines for Neovim, winbar alternative
MIT License
759 stars 14 forks source link

Powerline symbols on ends #50

Closed Kyuuhachi closed 9 months ago

Kyuuhachi commented 9 months ago

I would like to use Powerline symbols such as U+E0BC/E0BC (upper left and right triangle) on the ends of the winline, to make it a trapezoid instead of rectangle. But these work poorly on a nontransparent background, and I don't know how to set the background to transparent without messing up the rest of the display. Any idea on how to do this?

Somewhat similar to #13, and might be implementable through it, by setting only left and right border and fiddling with hl-FloatBorder.

b0o commented 9 months ago

Is this along the lines of what you're trying to do?

2023-11-16_17-40-42_region

incline.setup {
  render = function(props)
    local bg = '#A694ED'
    local fg = '#120433'
    local fname = vim.fn.fnamemodify(vim.api.nvim_buf_get_name(props.buf), ':t')
    return {
      { '', guifg = bg },
      {
        ' ' .. fname .. ' ',
        guibg = bg,
        guifg = fg,
      },
      { '', guifg = bg },
    }
  end,
}
Kyuuhachi commented 9 months ago

Yep, that turns out to be pretty much exactly what I'm looking for, thanks. Here's a lazy.nvim snippet that applies this style to an arbitrary render function.

    {
        "b0o/incline.nvim",
        opts = function(plug, opts)
            return vim.tbl_deep_extend("force", opts, {
                window = { padding = 0 },
                highlight = {
                    groups = {
                        InclineNormal = { guibg = "none" },
                        InclineNormalNC = { guibg = "none" },
                    }
                },
                render = function(params)
                    local content = opts.render(params)
                    local hl = vim.api.nvim_get_hl(0, { name = "NormalFloat", link = false })
                    local bg = string.format("#%06x", hl.bg);
                    return {
                        { '', guifg = bg },
                        {
                            {" ", content, " "},
                            guibg = bg,
                        },
                        { '', guifg = bg },
                    }
                end
            })
        end
    },

Didn't realize the markup was this nestable. That's super cool.