my dotfiles for arch
1return {
2 "goolord/alpha-nvim",
3 dependencies = {
4 {
5 "catppuccin/nvim",
6 name = "catppuccin",
7 priority = 1000, -- Load colorscheme before other plugins
8 },
9 "echasnovski/mini.icons",
10 "nvim-lua/plenary.nvim",
11 },
12 config = function()
13 local alpha_c = function()
14 local alpha = require("alpha")
15 local dashboard = require("alpha.themes.dashboard")
16 local scan = require("plenary.scandir")
17
18 -- Get the runtime path where your headers are stored
19 local runtime_path = vim.fn.stdpath("config") .. "/lua/plugins/alpha_headers"
20
21 -- Scan for all Lua files in the headers directory
22 local headers = {}
23 for _, file in ipairs(scan.scan_dir(runtime_path, { search_pattern = "%.lua$" })) do
24 -- Extract just the filename without extension and path
25 local header_name = vim.fn.fnamemodify(file, ":t:r")
26 table.insert(headers, header_name)
27 end
28
29 -- Randomly select a header
30 math.randomseed(os.time()) -- Initialize random seed
31 local random_header = headers[math.random(#headers)]
32
33 -- Construct the full path and require the header
34 local header = "plugins.alpha_headers." .. random_header
35 require(header).setup(dashboard)
36
37 dashboard.section.buttons.val = {
38 dashboard.button("n", " New file", "<Cmd>ene <CR>"),
39 dashboard.button("SPC p f", " Find file"),
40 dashboard.button("SPC p v", " Open Oil"),
41 dashboard.button("SPC w q", " Quit"),
42 }
43 for _, a in ipairs(dashboard.section.buttons.val) do
44 a.opts.width = 49
45 a.opts.cursor = -2
46 end
47
48 alpha.setup(dashboard.config)
49 end
50
51 alpha_c()
52 end,
53}