Open ChrisMGeo opened 9 months ago
I made a minimal implementation with some bugs: https://github.com/ChrisMGeo/dashboard-nvim/tree/background
I also changed up how you'd do the configs for testing, so try this config for lazy.nvim
:
{
"ChrisMGeo/dashboard-nvim",
branch = "background",
event = "VimEnter",
opts = function()
local bg = [[_|_
|
_|_
| ]]
local logo = [[
██╗ █████╗ ███████╗██╗ ██╗██╗ ██╗██╗███╗ ███╗ Z
██║ ██╔══██╗╚══███╔╝╚██╗ ██╔╝██║ ██║██║████╗ ████║ Z
██║ ███████║ ███╔╝ ╚████╔╝ ██║ ██║██║██╔████╔██║ z
██║ ██╔══██║ ███╔╝ ╚██╔╝ ╚██╗ ██╔╝██║██║╚██╔╝██║ z
███████╗██║ ██║███████╗ ██║ ╚████╔╝ ██║██║ ╚═╝ ██║
╚══════╝╚═╝ ╚═╝╚══════╝ ╚═╝ ╚═══╝ ╚═╝╚═╝ ╚═╝
]]
logo = string.rep("\n", 8) .. logo .. "\n\n"
local opts = {
theme = "doom",
hide = {
-- this is taken care of by lualine
-- enabling this messes up the actual laststatus setting after loading a file
statusline = false,
},
config = {
background = { lines = vim.split(bg, "\n"), tile = true, center = true },
header = vim.split(logo, "\n"),
-- stylua: ignore
center = {
{ action = "Telescope find_files", desc = " Find file", icon = " ", key = "f" },
{ action = "ene | startinsert", desc = " New file", icon = " ", key = "n" },
{ action = "Telescope oldfiles", desc = " Recent files", icon = " ", key = "r" },
{ action = "Telescope live_grep", desc = " Find text", icon = " ", key = "g" },
{ action = [[lua require("lazyvim.util").telescope.config_files()()]], desc = " Config", icon = " ", key = "c" },
{ action = 'lua require("persistence").load()', desc = " Restore Session", icon = " ", key = "s" },
{ action = "LazyExtras", desc = " Lazy Extras", icon = " ", key = "x" },
{ action = "Lazy", desc = " Lazy", icon = " ", key = "l" },
{ action = "qa", desc = " Quit", icon = " ", key = "q" },
},
footer = function()
local stats = require("lazy").stats()
local ms = (math.floor(stats.startuptime * 100 + 0.5) / 100)
return { "⚡ Neovim loaded " .. stats.loaded .. "/" .. stats.count .. " plugins in " .. ms .. "ms" }
end,
},
}
for _, button in ipairs(opts.config.center) do
button.desc = button.desc .. string.rep(" ", 43 - #button.desc)
button.key_format = " %s"
end
-- close Lazy and re-open when the dashboard is ready
if vim.o.filetype == "lazy" then
vim.cmd.close()
vim.api.nvim_create_autocmd("User", {
pattern = "DashboardLoaded",
callback = function()
require("lazy").show()
end,
})
end
return opts
end,
}
Nice concept but still need some work, unfortunately I'm not competent on this =( Is there any progress?
local bg = [[
]]
local logo = [[
! .-. _ _,
.---""""``"-,} : `"-.__.' \`-. _..-"/_,-""\
/_.,- \ / , _, \_.--. _.-" `.
.'.' '. / .'\/.-\ ; ""-; .' `,
':" \ .' /" `-; \ \ .' __ `.
/ .-" \ .' .' :-"""``"-: : ; / ","' \
.' .' '.' ; : / ` ' ; ; .' .--.._ `-, :
/ ; / ; /; :' ; ; ` \ : ; / / } , \_=' |
/ `\ _; : ; /| | ; ; \ ; ; __i-, /.-,-, : .' \ |
; ; / \ `,; :_; / ; ; ;\ \ \ : _T-" .-' / : _.',' / ; :
| / ; ; ;| ; ; __; ;\ ;\ J_ \ :-" .' : I. : : : ;
: : ; | `, `|T |`,(()\ `" T;());/=" : .'\ : / : / /` : / \
}| | ; \ ;; | ,"=-' `.,=' ; F' : ; __"`/ ;_/ / \ / :
|| ; ^ : `; ;. \ < / ; ; : :`; i`,; : / , : / :
|| \ ; : | , ; \ `, <= .'_.' ;: ;-' ;/ { : | / , :
:| : ; ' `, | \ _.' \ `,""`-, ,"/ / / / } | |/ ; /
!: | ;: `, :`-,\/,/ /\ \ Y==` / /; ; / .'| ;/; / .'
\ ; \ `! ,'.' : `. \ ; />`/ .'_,; \ ,' .'1" | ,' ` ; .'
\ ; ' ` .' / | _`"-, ;"`._.'_ -'" | ; F :/ ` :.' ; /
`, : : ,' / ; .' ,-' `i _//; `, /| ; ; \ :/ ; /
:\ : ; : /.'.-' /\ ; \ ( ; | | : / / ; ; /
\: : \ : ;.' / :/| \ \ ;| : \ : / / |/
:| \ \ \ | ;/ / T | \ :`: ; \ | : : ;'
!; \ \ \ | ; / : : `. |; ; \ | : ; |
; `. \ \ | /\ .' ; : : \ ;. `; ; ; /| ; ;
, `, \, \: : `.:" ; .'^ | `J ; \`, / .' : / ;/
\ \ ;`. \\ ; `@__.^-'" `. ; `, / /| ,`-, ; ;.' .' / /`
\ `! `.:\ ; "+,_.a._,-' ; ^ ;\ : ` / .' ;
`. `,`,_` `; `"` `"-,; / ) : \| :.'/ /
`-, \ `-,_`-.__ `-, / :.' : / ; /
\ `, `,`" `""--..__.....-----.._ `""\"` | /: | /
`, ; \ `. "-, `. ;' ; ; /
fsc \ :`, : `-,__ ',`. \ ` / .' /
\ : `,! `",`,`,J .'+' .'
`,! `J" `"/_.'
]]
Describe the solution you'd like I'd like a feature that'd allow the header to be used as the background, with custom options on how to handle when the window is much larger than the ascii art (tiling etc.). You wouldn't need to resize the ascii art when the window is much smaller than the art, instead just cropping the center of the art instead.
Describe alternatives you've considered Instead of modifying the header, we could also add a separate optional config option named background, that does the same thing, but you still have the header.
Additional context Some images for context: