mirror of
https://github.com/folke/snacks.nvim
synced 2025-07-12 07:35:08 +00:00

## Description A new dashboard plugin that comes with sane defaults, and can be fully customized to your liking. ## Screenshots     
130 lines
4 KiB
Lua
130 lines
4 KiB
Lua
local M = {}
|
|
|
|
M.style = "advanced"
|
|
|
|
---@type table<string, snacks.dashboard.Section>
|
|
M.examples = {}
|
|
|
|
-- Similar to the Emacs Doom dashboard
|
|
-- 
|
|
M.examples.doom = {
|
|
sections = {
|
|
{ section = "header" },
|
|
{ section = "keys", gap = 1, padding = 1 },
|
|
{ section = "startup" },
|
|
},
|
|
}
|
|
|
|
-- Similar to the Vim Startify dashboard
|
|
-- 
|
|
M.examples.startify = {
|
|
formats = {
|
|
key = function(item)
|
|
return { { "[", hl = "special" }, { item.key, hl = "key" }, { "]", hl = "special" } }
|
|
end,
|
|
},
|
|
sections = {
|
|
{ section = "terminal", cmd = "fortune -s | cowsay", hl = "header", padding = 1, indent = 8 },
|
|
{ title = "MRU", padding = 1 },
|
|
{ section = "recent_files", limit = 8, padding = 1 },
|
|
{ title = "MRU ", file = vim.fn.fnamemodify(".", ":~"), padding = 1 },
|
|
{ section = "recent_files", cwd = true, limit = 8, padding = 1 },
|
|
{ title = "Sessions", padding = 1 },
|
|
{ section = "projects", padding = 1 },
|
|
{ title = "Bookmarks", padding = 1 },
|
|
{ section = "keys" },
|
|
},
|
|
}
|
|
|
|
-- A more advanced example using multiple panes
|
|
-- 
|
|
M.examples.advanced = {
|
|
sections = {
|
|
{ section = "header" },
|
|
{
|
|
pane = 2,
|
|
section = "terminal",
|
|
cmd = "colorscript -e square",
|
|
height = 5,
|
|
padding = 1,
|
|
},
|
|
{ section = "keys", gap = 1, padding = 1 },
|
|
{ pane = 2, icon = " ", title = "Recent Files", section = "recent_files", indent = 2, padding = 1 },
|
|
{ pane = 2, icon = " ", title = "Projects", section = "projects", indent = 2, padding = 1 },
|
|
{
|
|
pane = 2,
|
|
icon = " ",
|
|
title = "Git Status",
|
|
section = "terminal",
|
|
enabled = vim.fn.isdirectory(".git") == 1,
|
|
cmd = "hub status --short --branch --renames",
|
|
height = 5,
|
|
padding = 1,
|
|
ttl = 5 * 60,
|
|
indent = 3,
|
|
},
|
|
{ section = "startup" },
|
|
},
|
|
}
|
|
|
|
-- A simple example with a header, keys, recent files, and projects
|
|
-- 
|
|
M.examples.files = {
|
|
sections = {
|
|
{ section = "header" },
|
|
{ section = "keys", gap = 1 },
|
|
{ icon = " ", title = "Recent Files", section = "recent_files", indent = 2, padding = { 2, 2 } },
|
|
{ icon = " ", title = "Projects", section = "projects", indent = 2, padding = 2 },
|
|
{ section = "startup" },
|
|
},
|
|
}
|
|
|
|
-- A more compact version of the `files` example
|
|
-- 
|
|
M.examples.compact_files = {
|
|
sections = {
|
|
{ section = "header" },
|
|
{ icon = " ", title = "Keymaps", section = "keys", indent = 2, padding = 1 },
|
|
{ icon = " ", title = "Recent Files", section = "recent_files", indent = 2, padding = 1 },
|
|
{ icon = " ", title = "Projects", section = "projects", indent = 2, padding = 1 },
|
|
{ section = "startup" },
|
|
},
|
|
}
|
|
|
|
-- An example using the `chafa` command to display an image
|
|
-- 
|
|
M.examples.chafa = {
|
|
sections = {
|
|
{
|
|
section = "terminal",
|
|
cmd = "chafa ~/.config/wall.png --format symbols --symbols vhalf --size 60x17 --stretch; sleep .1",
|
|
height = 17,
|
|
padding = 1,
|
|
},
|
|
{
|
|
pane = 2,
|
|
{ section = "keys", gap = 1, padding = 1 },
|
|
{ section = "startup" },
|
|
},
|
|
},
|
|
}
|
|
|
|
-- Pokemons, because why not?
|
|
-- 
|
|
M.examples.pokemon = {
|
|
sections = {
|
|
{ section = "header" },
|
|
{ section = "keys", gap = 1, padding = 1 },
|
|
{ section = "startup" },
|
|
{
|
|
section = "terminal",
|
|
cmd = "pokemon-colorscripts -r --no-title; sleep .1",
|
|
random = 10,
|
|
pane = 2,
|
|
indent = 4,
|
|
height = 30,
|
|
},
|
|
},
|
|
}
|
|
|
|
return M
|