feat(nvim): move to snacks dashboard

This commit is contained in:
Stefan Imhoff
2025-01-31 15:14:35 +01:00
parent ce51e2a38c
commit 88fff2aad9
6 changed files with 59 additions and 123 deletions

View File

@@ -32,7 +32,6 @@ require("lazy").setup({
{ import = "lazyvim.plugins.extras.linting.eslint" },
{ import = "lazyvim.plugins.extras.test.core" },
{ import = "lazyvim.plugins.extras.ui.mini-animate" },
{ import = "lazyvim.plugins.extras.ui.dashboard-nvim" },
-- import/override with your plugins
{ import = "plugins" },
},

View File

@@ -1,110 +0,0 @@
return {
"nvimdev/dashboard-nvim",
event = "VimEnter",
opts = function()
local logo = "\n"
.. "\n"
.. "┌─╮╭─╮╭─╮▖ ▖▖▄▄▗▄ \n"
.. "│ │├─┘│ │▝▖▞ ▌▌ ▌ ▌\n"
.. "╵ ╵╰─╯╰─╯ ▝ ▘▘ ▘ ▘\n"
.. "\n"
logo = string.rep("\n", 5) .. logo .. "\n\n"
local opts = {
theme = "doom",
hide = {
statusline = false,
},
config = {
header = vim.split(logo, "\n"),
center = {
{
action = "FzfLua files",
desc = " Find file",
icon = "",
key = "f",
},
{
action = "ene | startinsert",
desc = " New file",
icon = "",
key = "n",
},
{
action = "FzfLua oldfiles",
desc = " Recent files",
icon = "",
key = "r",
},
{
action = "FzfLua live_grep",
desc = " Find text",
icon = "",
key = "g",
},
{
action = "Telescope projects",
desc = " Find project",
icon = "",
key = "p",
},
{
action = 'lua require("persistence").load()',
desc = " Restore Session",
icon = "",
key = "s",
},
{
action = "LazyExtras",
desc = " Lazy Extras",
icon = "",
key = "e",
},
{
action = "Lazy",
desc = " Lazy",
icon = "󰒲 ",
key = "l",
},
{
action = "Mason",
desc = " Mason",
icon = "󱊈 ",
key = "m",
},
{
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)
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,
}

View File

@@ -0,0 +1,41 @@
-- 🍿 A collection of QoL plugins for Neovim
-- https://github.com/folke/snacks.nvim/tree/main
return {
"folke/snacks.nvim",
opts = {
dashboard = {
formats = {
header = { "%s", hl = "String", align = "center" },
icon = { "%s", hl = "String" },
},
preset = {
keys = {
{ icon = "", key = "f", desc = "Find File", action = ":lua Snacks.dashboard.pick('files')" },
{ icon = "", key = "n", desc = "New File", action = ":ene | startinsert" },
{ icon = "", key = "r", desc = "Recent Files", action = ":lua Snacks.dashboard.pick('oldfiles')" },
{ icon = "", key = "g", desc = "Find Text", action = ":lua Snacks.dashboard.pick('live_grep')" },
{ icon = "", key = "p", desc = "Find Project", action = ":Telescope projects" },
{ icon = "", key = "s", desc = "Restore Session", section = "session" },
{ icon = "", key = "c", desc = "Config", action = ":lua Snacks.dashboard.pick('files', {cwd = vim.fn.stdpath('config')})" },
{ icon = "", key = "e", desc = "LazyExtras", action = ":LazyExtras" },
{ icon = "󰒲 ", key = "l", desc = "Lazy", action = ":Lazy", enabled = package.loaded.lazy ~= nil },
{ icon = "󱊈 ", key = "m", desc = "Mason", action = ":Mason" },
{ icon = "", key = "q", desc = "Quit", action = ":qa" },
},
header = [[
┌─╮╭─╮╭─╮▖ ▖▖▄▄▗▄
│ │├─┘│ │▝▖▞ ▌▌ ▌ ▌
╵ ╵╰─╯╰─╯ ▝ ▘▘ ▘ ▘
]],
},
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" },
},
},
},
}

View File

@@ -1,13 +1,11 @@
-- Remove all background colors to make Neovim transparent
-- https://github.com/xiyaowong/nvim-transparent
return {
"xiyaowong/nvim-transparent",
opts = {
extra_groups = {
"TelescopeBorder",
"TelescopeNormal",
-- "NeoTreeNormal",
-- "NeoTreeNormalNC",
},
},
"xiyaowong/nvim-transparent",
opts = {
extra_groups = {
"TelescopeBorder",
"TelescopeNormal",
},
},
}