src/content/docs/recipes/dashboard.mdx
AstroNvim comes with snacks.dashboard by default for providing a dashboard/home screen. This page provides a few common customization options.
If you want to customize your header on the dashboard you can do this easily by overriding the snacks.nvim options in your plugins:
return {
"folke/snacks.nvim",
opts = {
dashboard = {
preset = {
header = table.concat({
"My Custom",
"Dashboard Header",
}, "\n"),
},
},
},
}
In order to customize buttons presented on the dashboard, you can modify snacks.nvim options:
return {
"folke/snacks.nvim",
opts = {
dashboard = {
preset = {
keys = {
{
key = "h",
action = function()
vim.notify("Hello World!")
end,
desc = "Say Hi",
},
},
},
},
},
}
If you want to make the dashboard/home screen open automatically when you close the last buffer in your session you can add the following to your AstroCore mappings configuration:
return {
"AstroNvim/astrocore",
---@type AstroCoreOpts
opts = {
mappings = {
n = {
["<Leader>c"] = {
function()
local bufs = vim.fn.getbufinfo({ buflisted = true })
require("astrocore.buffer").close(0)
if not bufs[2] then
require("snacks").dashboard()
end
end,
desc = "Close buffer",
},
},
},
},
}