feat(snacks): use snacks.dashboard
as the default dashboard. moved dashboard-nvim
to extras (#4832)
## Description <!-- Describe the big picture of your changes to communicate to the maintainers why we should accept this pull request. --> Snacks has a new dashboard plugin that will be LazyVim's default. Check the docs at https://github.com/folke/snacks.nvim/blob/main/docs/dashboard.md ## Related Issue(s) <!-- If this PR fixes any issues, please link to the issue here. - Fixes #<issue_number> --> ## Screenshots <!-- Add screenshots of the changes if applicable. --> ## Checklist - [x] I've read the [CONTRIBUTING](https://github.com/LazyVim/LazyVim/blob/main/CONTRIBUTING.md) guidelines.
This commit is contained in:
7
NEWS.md
7
NEWS.md
@ -2,6 +2,13 @@
|
|||||||
|
|
||||||
## 13.x
|
## 13.x
|
||||||
|
|
||||||
|
- **LazyVim** now uses `Snacks.dashboard` as the default dashboard.
|
||||||
|
Check the [docs](https://github.com/folke/snacks.nvim/blob/main/docs/dashboard.md),
|
||||||
|
for more information and examples.
|
||||||
|
|
||||||
|
- A new [dashboard-nvim](https://github.com/nvimdev/dashboard-nvim) extra
|
||||||
|
is available for those who prefer the old dashboard.
|
||||||
|
|
||||||
- Big new release with a lot of changes and improvements!
|
- Big new release with a lot of changes and improvements!
|
||||||
|
|
||||||
- The biggest change is the move of a bunch of core features to
|
- The biggest change is the move of a bunch of core features to
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
return {
|
return {
|
||||||
|
|
||||||
{ "nvimdev/dashboard-nvim", enabled = false },
|
{ "folke/snacks.nvim", opts = { dashboard = { enabled = false } } },
|
||||||
{ "echasnovski/mini.starter", enabled = false },
|
|
||||||
-- Dashboard. This runs when neovim starts, and is what displays
|
-- Dashboard. This runs when neovim starts, and is what displays
|
||||||
-- the "LAZYVIM" banner.
|
-- the "LAZYVIM" banner.
|
||||||
{
|
{
|
||||||
|
68
lua/lazyvim/plugins/extras/ui/dashboard-nvim.lua
Normal file
68
lua/lazyvim/plugins/extras/ui/dashboard-nvim.lua
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
return {
|
||||||
|
{ "folke/snacks.nvim", opts = { dashboard = { enabled = false } } },
|
||||||
|
{
|
||||||
|
"nvimdev/dashboard-nvim",
|
||||||
|
lazy = false, -- As https://github.com/nvimdev/dashboard-nvim/pull/450, dashboard-nvim shouldn't be lazy-loaded to properly handle stdin.
|
||||||
|
opts = function()
|
||||||
|
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 = {
|
||||||
|
header = vim.split(logo, "\n"),
|
||||||
|
-- stylua: ignore
|
||||||
|
center = {
|
||||||
|
{ action = 'lua LazyVim.pick()()', desc = " Find File", icon = " ", key = "f" },
|
||||||
|
{ action = "ene | startinsert", desc = " New File", icon = " ", key = "n" },
|
||||||
|
{ action = 'lua LazyVim.pick("oldfiles")()', desc = " Recent Files", icon = " ", key = "r" },
|
||||||
|
{ action = 'lua LazyVim.pick("live_grep")()', desc = " Find Text", icon = " ", key = "g" },
|
||||||
|
{ action = 'lua LazyVim.pick.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 = function() vim.api.nvim_input("<cmd>qa<cr>") end, 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
|
||||||
|
|
||||||
|
-- open dashboard after closing lazy
|
||||||
|
if vim.o.filetype == "lazy" then
|
||||||
|
vim.api.nvim_create_autocmd("WinClosed", {
|
||||||
|
pattern = tostring(vim.api.nvim_get_current_win()),
|
||||||
|
once = true,
|
||||||
|
callback = function()
|
||||||
|
vim.schedule(function()
|
||||||
|
vim.api.nvim_exec_autocmds("UIEnter", { group = "dashboard" })
|
||||||
|
end)
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
return opts
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
}
|
@ -1,8 +1,7 @@
|
|||||||
-- start screen
|
-- start screen
|
||||||
return {
|
return {
|
||||||
-- disable alpha
|
-- disable alpha
|
||||||
{ "goolord/alpha-nvim", enabled = false },
|
{ "folke/snacks.nvim", opts = { dashboard = { enabled = false } } },
|
||||||
{ "nvimdev/dashboard-nvim", enabled = false },
|
|
||||||
|
|
||||||
-- enable mini.starter
|
-- enable mini.starter
|
||||||
{
|
{
|
||||||
|
@ -30,11 +30,9 @@ return {
|
|||||||
opts = function()
|
opts = function()
|
||||||
---@type snacks.Config
|
---@type snacks.Config
|
||||||
return {
|
return {
|
||||||
|
bigfile = { enabled = true },
|
||||||
notifier = { enabled = true },
|
notifier = { enabled = true },
|
||||||
quickfile = { enabled = true },
|
quickfile = { enabled = true },
|
||||||
bigfile = { enabled = true },
|
|
||||||
words = { enabled = true },
|
|
||||||
toggle = { map = LazyVim.safe_keymap_set },
|
|
||||||
statuscolumn = { enabled = false }, -- we set this in options.lua
|
statuscolumn = { enabled = false }, -- we set this in options.lua
|
||||||
terminal = {
|
terminal = {
|
||||||
win = {
|
win = {
|
||||||
@ -46,6 +44,8 @@ return {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
toggle = { map = LazyVim.safe_keymap_set },
|
||||||
|
words = { enabled = true },
|
||||||
}
|
}
|
||||||
end,
|
end,
|
||||||
keys = {
|
keys = {
|
||||||
|
@ -307,68 +307,31 @@ return {
|
|||||||
{ "MunifTanjim/nui.nvim", lazy = true },
|
{ "MunifTanjim/nui.nvim", lazy = true },
|
||||||
|
|
||||||
{
|
{
|
||||||
"nvimdev/dashboard-nvim",
|
"folke/snacks.nvim",
|
||||||
lazy = false, -- As https://github.com/nvimdev/dashboard-nvim/pull/450, dashboard-nvim shouldn't be lazy-loaded to properly handle stdin.
|
opts = {
|
||||||
opts = function()
|
dashboard = {
|
||||||
local logo = [[
|
preset = {
|
||||||
|
header = [[
|
||||||
██╗ █████╗ ███████╗██╗ ██╗██╗ ██╗██╗███╗ ███╗ Z
|
██╗ █████╗ ███████╗██╗ ██╗██╗ ██╗██╗███╗ ███╗ Z
|
||||||
██║ ██╔══██╗╚══███╔╝╚██╗ ██╔╝██║ ██║██║████╗ ████║ Z
|
██║ ██╔══██╗╚══███╔╝╚██╗ ██╔╝██║ ██║██║████╗ ████║ Z
|
||||||
██║ ███████║ ███╔╝ ╚████╔╝ ██║ ██║██║██╔████╔██║ z
|
██║ ███████║ ███╔╝ ╚████╔╝ ██║ ██║██║██╔████╔██║ z
|
||||||
██║ ██╔══██║ ███╔╝ ╚██╔╝ ╚██╗ ██╔╝██║██║╚██╔╝██║ z
|
██║ ██╔══██║ ███╔╝ ╚██╔╝ ╚██╗ ██╔╝██║██║╚██╔╝██║ z
|
||||||
███████╗██║ ██║███████╗ ██║ ╚████╔╝ ██║██║ ╚═╝ ██║
|
███████╗██║ ██║███████╗ ██║ ╚████╔╝ ██║██║ ╚═╝ ██║
|
||||||
╚══════╝╚═╝ ╚═╝╚══════╝ ╚═╝ ╚═══╝ ╚═╝╚═╝ ╚═╝
|
╚══════╝╚═╝ ╚═╝╚══════╝ ╚═╝ ╚═══╝ ╚═╝╚═╝ ╚═╝
|
||||||
]]
|
]],
|
||||||
|
---@param keys snacks.dashboard.Item[]
|
||||||
logo = string.rep("\n", 8) .. logo .. "\n\n"
|
keys = function(keys)
|
||||||
|
-- add LazyExtra before Lazy
|
||||||
local opts = {
|
for k, key in ipairs(keys) do
|
||||||
theme = "doom",
|
if key.action == ":Lazy" then
|
||||||
hide = {
|
key.key = "l" -- we don't have multiple panes, so `l` is free
|
||||||
-- this is taken care of by lualine
|
table.insert(keys, k, { icon = " ", desc = "Lazy Extras", action = ":LazyExtras", key = "x" })
|
||||||
-- enabling this messes up the actual laststatus setting after loading a file
|
break
|
||||||
statusline = false,
|
|
||||||
},
|
|
||||||
config = {
|
|
||||||
header = vim.split(logo, "\n"),
|
|
||||||
-- stylua: ignore
|
|
||||||
center = {
|
|
||||||
{ action = 'lua LazyVim.pick()()', desc = " Find File", icon = " ", key = "f" },
|
|
||||||
{ action = "ene | startinsert", desc = " New File", icon = " ", key = "n" },
|
|
||||||
{ action = 'lua LazyVim.pick("oldfiles")()', desc = " Recent Files", icon = " ", key = "r" },
|
|
||||||
{ action = 'lua LazyVim.pick("live_grep")()', desc = " Find Text", icon = " ", key = "g" },
|
|
||||||
{ action = 'lua LazyVim.pick.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 = function() vim.api.nvim_input("<cmd>qa<cr>") end, 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
|
end
|
||||||
|
|
||||||
-- open dashboard after closing lazy
|
|
||||||
if vim.o.filetype == "lazy" then
|
|
||||||
vim.api.nvim_create_autocmd("WinClosed", {
|
|
||||||
pattern = tostring(vim.api.nvim_get_current_win()),
|
|
||||||
once = true,
|
|
||||||
callback = function()
|
|
||||||
vim.schedule(function()
|
|
||||||
vim.api.nvim_exec_autocmds("UIEnter", { group = "dashboard" })
|
|
||||||
end)
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
end
|
end
|
||||||
|
|
||||||
return opts
|
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user