goolord / alpha-nvim

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

Center for groups #18

Open Mte90 opened 3 years ago

Mte90 commented 3 years ago

Looking at the code the position is not supported for groups but I am getting this: Screenshot_20210910_173013

I would like to have also groups centered.

goolord commented 2 years ago

@Mte90 what i do at the moment is that i have a width option https://github.com/goolord/alpha-nvim/blob/main/lua/alpha/themes/dashboard.lua#L40 which in conjunction with the center will make everything with the same width align properly

i do eventually want to have 'center' working for groups, it hasn't been a priority for me since this works so nicely for me already

goolord commented 2 years ago

like, this should have the same effect as centering a group

local group = {
  type = "group"
  val = ...
}

for _, el in pairs(group.val) do
  el.opts.position = "center"
  el.opts.width = 50 -- or some other value
end
Dukihung commented 1 year ago

Hi, how do i center in startify theme and add bookmarks?

goolord commented 1 year ago

how to center startify: check out the https://github.com/goolord/alpha-nvim/blob/main/lua/alpha/themes/theta.lua theta theme, it's essentially that. you can copy this module and tweak it to define your own theme if you like.

to add bookmarks to theta you can do something like

local alpha = require'alpha'
local theta = require'alpha.themes.startify'
local dashboard = require'alpha.dashboard'
theta.buttons.val = {
    dashboard.button("c", "  configuration", "<cmd>cd ~/.config/nvim/ <cr>"),
    dashboard.button("n", "  notes", "<cmd>e ~/notes.md <cr>"),
}
alpha.setup(theta.config)

(the theta module could definitely use some TLC to have a more similar api to the other 2 themes)

@Dukihung

andersonfelix commented 8 months ago

I used theta config:

local alpha = require("alpha")
local config = require("alpha.themes.theta").config
-- there's no name, access via index
config.layout[2].val = {} // my ascii
alpha.setup(config)

Neovim ascii