goolord / alpha-nvim

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

How to configure startify ? #99

Closed nathani-axis closed 2 years ago

nathani-axis commented 2 years ago

hey, I'm trying to understand how to configure the startify elements. Specifically I'd want to have all the recent files in the current project/folder to appear first, and either have the recent files globally to be the second list, or just gone.

Is there a place I can into that has the configuration, and that I can play with ? I'd be happy to try stuff but I have no idea where to start ^^

goolord commented 2 years ago
local startify = require('alpha.themes.startify')

startify.config.layout = {
    { type = "padding", val = 1 },
    startify.sections.header,
    { type = "padding", val = 2 },
    startify.section.top_buttons,
    { -- mru_cwd
        type = "group",
        val = {
            { type = "padding", val = 1 },
            { type = "text", val = mru_title, opts = { hl = "SpecialComment", shrink_margin = false } },
            { type = "padding", val = 1 },
            {
                type = "group",
                val = function()
                    return { mru(0, vim.fn.getcwd()) }
                end,
                opts = { shrink_margin = false },
            },
        },
    },
    { -- mru
        type = "group",
        val = {
            { type = "padding", val = 1 },
            { type = "text", val = "MRU", opts = { hl = "SpecialComment" } },
            { type = "padding", val = 1 },
            {
                type = "group",
                val = function()
                    return { mru(10) }
                end,
            },
        },
    },
    { type = "padding", val = 1 },
    startify.section.bottom_buttons,
    startify.section.footer,
}

require('alpha').setup(startify.config)

if you want to get really deep into it, I would read the source code for the 3 available themes. there's also thorough documentation for alpha's different element types @ https://github.com/goolord/alpha-nvim/blob/main/doc/alpha.txt#L30, there's also some theme-specific configuration examples later in the docs

goolord commented 2 years ago

also, tracking a sort of 'easy mode' config option for swapping mru and mru_cwd

https://github.com/goolord/alpha-nvim/issues/97