return { "folke/snacks.nvim", priority = 1000, lazy = false, ---@type snacks.Config opts = { explorer = { enabled = false }, bigfile = { enabled = true }, quickfile = { enabled = true }, ---@class snacks.animate.Config ---@field easing? snacks.animate.easing|snacks.animate.easing.Fn animate = { enabled = false, ---@type snacks.animate.Duration|number duration = 4, -- ms per step easing = "linear", fps = 90, -- frames per second. Global setting for all animations }, notifier = { enabled = true }, indent = { enabled = true }, toggle = { enabled = true }, scroll = { enabled = true }, ---@class snacks.dashboard.Config ---@field enabled? boolean ---@field sections snacks.dashboard.Section ---@field formats table dashboard = { row = nil, col = nil, pane_gap = 2, enabled = true, sections = { { section = "header" }, { pane = 2, section = "terminal", cmd = "colorscript -e square", height = 6, 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 = function() return Snacks.git.get_root() ~= nil end, cmd = "git status --short --branch --renames", height = 5, padding = 1, ttl = 5 * 60, indent = 3, }, { section = "startup" }, }, }, }, keys = { -- Top Pickers & Explorer { "sf", function() Snacks.picker.smart() end, desc = "Smart Find Files", }, { "", function() Snacks.picker.buffers() end, desc = "Buffers", }, { "/", function() Snacks.picker.grep() end, desc = "Grep", }, { ":", function() Snacks.picker.command_history() end, desc = "Command History", }, { "n", function() Snacks.picker.notifications() end, desc = "Notification History", }, -- { -- "e", -- function() -- Snacks.explorer() -- end, -- desc = "File Explorer", -- }, -- find -- { -- "fb", -- function() -- Snacks.picker.buffers() -- end, -- desc = "Buffers", -- }, -- both of the next two bindings are the same, just for different keymaps -- ─< find [N]eovim config >──────────────────────────────────────────────────────────── { "fn", function() Snacks.picker.files({ cwd = vim.fn.stdpath("config") }) end, desc = "Find Config File", }, -- ─< find neovim [C]onfig >──────────────────────────────────────────────────────────── { "fc", function() Snacks.picker.files({ cwd = vim.fn.stdpath("config") }) end, desc = "Find Config File", }, { "ff", function() Snacks.picker.files() end, desc = "Find Files", }, { "fg", function() Snacks.picker.git_files() end, desc = "Find Git Files", }, { "fp", function() Snacks.picker.projects() end, desc = "Projects", }, { "fr", function() Snacks.picker.recent() end, desc = "Recent", }, -- git { "gb", function() Snacks.picker.git_branches() end, desc = "Git Branches", }, { "gl", function() Snacks.picker.git_log() end, desc = "Git Log", }, { "gL", function() Snacks.picker.git_log_line() end, desc = "Git Log Line", }, { "gs", function() Snacks.picker.git_status() end, desc = "Git Status", }, { "gS", function() Snacks.picker.git_stash() end, desc = "Git Stash", }, { "gd", function() Snacks.picker.git_diff() end, desc = "Git Diff (Hunks)", }, { "gf", function() Snacks.picker.git_log_file() end, desc = "Git Log File", }, -- Grep { "sg", function() Snacks.picker.grep() end, desc = "Grep", }, { "sw", function() Snacks.picker.grep_word() end, desc = "Visual selection or word", mode = { "n", "x" }, }, { "T", function() Snacks.picker.colorschemes() end, desc = "Colorschemes", }, -- LSP { "gd", function() Snacks.picker.lsp_definitions() end, desc = "Goto Definition", }, { "gD", function() Snacks.picker.lsp_declarations() end, desc = "Goto Declaration", }, { "gr", function() Snacks.picker.lsp_references() end, nowait = true, desc = "References", }, { "gI", function() Snacks.picker.lsp_implementations() end, desc = "Goto Implementation", }, { "gy", function() Snacks.picker.lsp_type_definitions() end, desc = "Goto T[y]pe Definition", }, -- Other { "z", function() Snacks.zen() end, desc = "Toggle Zen Mode", }, { "Z", function() Snacks.zen.zoom() end, desc = "Toggle Zoom", }, { "n", function() Snacks.notifier.show_history() end, desc = "Notification History", }, { "cR", function() Snacks.rename.rename_file() end, desc = "Rename File", }, { "gB", function() Snacks.gitbrowse() end, desc = "Git Browse", mode = { "n", "v" }, }, { "gg", function() Snacks.lazygit() end, desc = "Lazygit", }, { "un", function() Snacks.notifier.hide() end, desc = "Dismiss All Notifications", }, { "N", desc = "Neovim News", function() Snacks.win({ file = vim.api.nvim_get_runtime_file("doc/news.txt", false)[1], width = 0.6, height = 0.6, wo = { spell = false, wrap = false, signcolumn = "yes", statuscolumn = " ", conceallevel = 3, }, }) end, }, }, init = function() vim.api.nvim_create_autocmd("User", { pattern = "VeryLazy", callback = function() -- Setup some globals for debugging (lazy-loaded) _G.dd = function(...) Snacks.debug.inspect(...) end _G.bt = function() Snacks.debug.backtrace() end vim.print = _G.dd -- Override print to use snacks for `:=` command -- Create some toggle mappings Snacks.toggle.option("spell", { name = "Spelling" }):map("us") Snacks.toggle.option("wrap", { name = "Wrap" }):map("uw") Snacks.toggle.option("relativenumber", { name = "Relative Number" }):map("uL") Snacks.toggle.diagnostics():map("ud") Snacks.toggle.line_number():map("ul") Snacks.toggle .option("conceallevel", { off = 0, on = vim.o.conceallevel > 0 and vim.o.conceallevel or 2 }) :map("uc") Snacks.toggle.treesitter():map("uT") Snacks.toggle .option("background", { off = "light", on = "dark", name = "Dark Background" }) :map("ub") Snacks.toggle.inlay_hints():map("uh") Snacks.toggle.indent():map("ug") Snacks.toggle.dim():map("uD") end, }) end, dependencies = { { "RileyGabrielson/inspire.nvim", config = function() require("inspire").setup({ -- 'daily' or 'random' mode = "daily", -- Override the default quotes quotes = { { text = "My First Custom Quote", author = "Me" }, { text = "My Second Custom Quote", author = "Myself" }, { text = "My Third Custom Quote", author = "and I" }, }, }) end, }, { "folke/persistence.nvim", event = "BufReadPre", opts = {}, -- stylua: ignore keys = { -- { "qs", function() require("persistence").load() end, desc = "Restore Session" }, -- { "ql", function() require("persistence").load({ last = true }) end, desc = "Restore Last Session" }, -- { "qd", function() require("persistence").stop() end, desc = "Don't Save Current Session" }, { "db", ":Dashboard", desc = "Dashboard"}, { "dq", function() require("inspire").show_quote() end, desc = "Show Inspire Quote"}, }, }, }, }