goolord / alpha-nvim

a lua powered greeter like vim-startify / dashboard-nvim
MIT License
1.82k stars 109 forks source link

Full screen banner/header? #136

Open ChrisMGeo opened 2 years ago

ChrisMGeo commented 2 years ago

Sometimes I want to keep larger ASCII art as the header on the home page, but due to how the header is just on top of the options like new file, recent, etc. It doesn't look as good as I'd want it to. A solution to this would be to render the header on the entire full page and not on top of the options and render the options over it and make this an additional feature to enable in the user/init.lua and not a default.

goolord commented 2 years ago

i'm not totally sure what you mean, something like this?

alpha.setup {
    layout = {
        { type = "text", val = someAsciiArt, opts = { position = "center" } },
    }
}
goolord commented 2 years ago

ohhh like a background or something. interesting. i'll give it a shot at some point

LamprosPitsillos commented 1 year ago

I was just thinking about this... How would one start on this? I am interested in doing a PR. But it sounds a bit impossible... First of all is it possible to put the ascii art behind the MRU/Dashboard lists? Would be interested in discussing this.

goolord commented 1 year ago

probably a new element for writing virtual text is the approach I would take

goolord commented 1 year ago

trying to experiment this but i can't get the virtual text to actually draw... maybe someone else will have better luck or I'll get to this some other time

function layout_element.virtual_text(el, conf, state)
    local ns = state.vt_ns
    if ns == nil then
        ns = vim.api.nvim_create_namespace('alpha')
        state.vt_ns = ns
    end
    local opts = vim.tbl_extend("keep", el.opts or {}, {
        virt_text = el.val,
        virt_text_pos = 'overlay',
        virt_text_win_col = 10,
        virt_text_hide = false,
    })
    vim.api.nvim_buf_set_mark(state.buffer, 'a', el.line(state.line), el.col, opts)
    return {}, {}
end