Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to use theta theme #281

Open
KikeSenpai opened this issue May 14, 2024 · 2 comments
Open

Unable to use theta theme #281

KikeSenpai opened this issue May 14, 2024 · 2 comments

Comments

@KikeSenpai
Copy link

Hi, I am unable to use the theta theme, the startify works well, I wanted to try the theta theme to get a centralized greeter page.

the error is

Failed to run `config` for alpha-nvim

...nrique.delgado/.config/nvim/lua/custom/plugins/alpha.lua:12: attempt to index field 'section' (a nil value)

# stacktrace:
  - lua/custom/plugins/alpha.lua:12 _in_ **config**
  - lua/lazy-plugins.lua:3
  - init.lua:70

This is my config for alpha

return {
  'goolord/alpha-nvim',
  dependencies = {
    'nvim-tree/nvim-web-devicons',
    'nvim-lua/plenary.nvim',
  },
  config = function()
    local alpha = require 'alpha'
    local dashboard = require 'alpha.themes.theta'
    dashboard.section.header.val = {
      [[                                                                                                                ]],
      [[                                                                                                                ]],
      [[                                                                                                                ]],
      [[  ████████                    ██           ██                    ████                         ████████          ]],
      [[         █████                ██           ██                 ████  █████                  ████                 ]],
      [[            ███               ██           ██               ███        ███                ██                    ]],
      [[             ██               ██           ██              ███           ██              ██                     ]],
      [[              ██              ██           ██              ██            ██          █████████████████████████  ]],
      [[             ██               ██           ██              ██            ██              ██                     ]],
      [[            ███                ██         ██               ██            ██               ██                    ]],
      [[         █████                  ████   ████                ██            ██                ████                 ]],
      [[  ████████                         █████                   ██            ██                   ████████          ]],
      [[                                                                                                                ]],
      [[                                                                                                                ]],
      [[                                                                                                                ]],
    }

    -- Set buttons
    dashboard.section.top_buttons.val = {
      dashboard.button('e', '  New file', ':ene <BAR> startinsert <CR>'),
    }
    dashboard.section.bottom_buttons.val = {
      dashboard.button('q', '󰅚  Quit NVIM', ':qa<CR>'),
    }

    -- Disable MRU
    dashboard.section.mru.val = { { type = "padding", val = 0 } }

    -- Set footer
    local footer = [[
      
      I must not fear. Fear is the mind-killer. Fear is the little-death that brings total obliteration.
      I will face my fear. I will permit it to pass over me and through me. And when it has gone past
      I will turn the inner eye to see its path. Where the fear has gone there will be nothing. Only I will remain.
    ]]
    dashboard.section.footer.val = {
      {
        type = 'text',
        val = footer,
      },
    }

    -- Keymaps
    vim.keymap.set('n', '<leader>a', ':Alpha<CR>', { desc = 'Goto Greeter Screen' })

    alpha.setup(dashboard.config)
  end,
}

-- vim: ts=2 sts=2 sw=2 et
@nohr
Copy link

nohr commented Jun 18, 2024

theta uses buttons from the dashboard theme. I think what makes it different from dashboard is its use of recent files. since you don't need those, you can accomplish this with the dashboard theme instead. see alpha-dune.lua:

return {
  "goolord/alpha-nvim",
  dependencies = {
    "nvim-tree/nvim-web-devicons",
    "nvim-lua/plenary.nvim",
  },
  lazy = false,
  config = function()
    local alpha = require "alpha"
    local dashboard = require "alpha.themes.dashboard"

    dashboard.section.header.val = {
      [[                                                                                                                ]],
      [[                                                                                                                ]],
      [[                                                                                                                ]],
      [[  ████████                    ██           ██                    ████                         ████████          ]],
      [[         █████                ██           ██                 ████  █████                  ████                 ]],
      [[            ███               ██           ██               ███        ███                ██                    ]],
      [[             ██               ██           ██              ███           ██              ██                     ]],
      [[              ██              ██           ██              ██            ██          █████████████████          ]],
      [[             ██               ██           ██              ██            ██              ██                     ]],
      [[            ███                ██         ██               ██            ██               ██                    ]],
      [[         █████                  ████   ████                ██            ██                ████                 ]],
      [[  ████████                         █████                   ██            ██                   ████████          ]],
      [[                                                                                                                ]],
      [[                                                                                                                ]],
      [[                                                                                                                ]],
    }

    dashboard.section.buttons.val = {
      dashboard.button("e", "  New file", ":ene <BAR> startinsert <CR>"),
      dashboard.button("q", "󰅚  Quit NVIM", ":qa<CR>"),
      { type = "padding", val = 2 },
    }

    -- Set footer
    local footer = [[
      
      I must not fear. Fear is the mind-killer. Fear is the little-death that brings total obliteration.
      I will face my fear. I will permit it to pass over me and through me. And when it has gone past
      I will turn the inner eye to see its path. Where the fear has gone there will be nothing. Only I will remain.
    ]]

    dashboard.section.footer.val = footer
    dashboard.section.footer.type = "text"
    dashboard.section.footer.opts = {
      position = "center",
      hl = "Number",
    }

    -- Keymaps
    vim.keymap.set("n", "<leader>a", ":Alpha<CR>", { desc = "Goto Greeter Screen" })

    alpha.setup(dashboard.config)
  end,
}

you should end up with this:
Screenshot 2024-06-18 at 06 36 23

@steven-na
Copy link

steven-na commented Aug 16, 2024

Theta doesn't have the same layout as startify, so the variables have different names.

You can access the header of theta by using dashboard.header.val rather than dashboard.section.header.val

image
image
(My variable is named theta, while yours is dashboard)
You can see the structure of the theta theme here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants