Gif
AndreM222 opened this issue · 1 comments
AndreM222 commented
Hi awesome plugin but I wanted to set up a animated gif and is working except for the fact that is not centering and wanted some help regarding the situation. Thanks ind advance.
It looks like this
the code is this
require("alpha.term")
local dashboard = require("alpha.themes.dashboard")
local dynamic_header = {
type = "terminal",
command = "chafa -c full --fg-only --symbols braille " .. os.getenv("USERPROFILE") .. "\\OneDrive\\Imágenes\\EnergyGif.gif",
width = 90,
height = 24,
opts = {
position = "center",-- position = "left",
redraw = true,
window_config = {}
}
}
local if_nil = vim.F.if_nil
local footer = {
type = "text",
val = "",
opts = {
position = "center",
hl = "Number"
}
}
local leader = "SPC"
--- @param sc string
--- @param txt string
--- @param keybind string? optional
--- @param keybind_opts table? optional
local function button(sc, txt, keybind, keybind_opts)
local sc_ = sc:gsub("%s", ""):gsub(leader, "<leader>")
local opts = {
position = "center",
shortcut = sc,
cursor = 5,
width = 50,
align_shortcut = "right",
hl_shortcut = "Keyword",
}
if keybind then
keybind_opts = if_nil(keybind_opts, { noremap = true, silent = true, nowait = true })
opts.keymap = { "n", sc_, keybind, keybind_opts }
end
local function on_press()
local key = vim.api.nvim_replace_termcodes(keybind or sc_ .. "<Ignore>", true, false, true)
vim.api.nvim_feedkeys(key, "t", false)
end
return {
type = "button",
val = txt,
on_press = on_press,
opts = opts,
}
end
local buttons = {
type = "group",
val = {
button("e", " New file", "<cmd>ene <CR>"),
button("\\t", " Find file"),
button("\\\\", " Recently opened files"),
button("\\l", " Find word"),
button("\\r", " Open last session"),
},
opts = {
spacing = 1,
},
}
local section = {
header = dynamic_header,
buttons = buttons,
footer = footer,
}
local config = {
layout = {
{ type = "padding", val = 5 },
section.header,
{ type = "padding", val = 2 },
section.buttons,
section.footer,
},
opts = {
margin = 5,
noautocmd = true,
redraw_on_resize = true
},
}
dashboard.opts = config
require'alpha'.setup(dashboard.opts)
goolord commented
you probably need to decrease the width of the dynamic_header
. i can only center the window, not the text in the window