From 53ca4b891ac34bdf4960933f77dd0697016f1718 Mon Sep 17 00:00:00 2001 From: Stevan Freeborn <65925598+StevanFreeborn@users.noreply.github.com> Date: Sun, 26 Jan 2025 21:17:01 -0600 Subject: [PATCH] feat: add dashboard + persistenace --- lazy-lock.json | 2 ++ lua/plugins/dashboard.lua | 71 +++++++++++++++++++++++++++++++++++++ lua/plugins/persistance.lua | 23 ++++++++++++ lua/plugins/treesitter.lua | 6 ++-- 4 files changed, 100 insertions(+), 2 deletions(-) create mode 100644 lua/plugins/dashboard.lua create mode 100644 lua/plugins/persistance.lua diff --git a/lazy-lock.json b/lazy-lock.json index 744cd4e..946d4c0 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -5,6 +5,7 @@ "cmp-nvim-lsp": { "branch": "main", "commit": "99290b3ec1322070bcfb9e846450a46f6efa50f0" }, "cmp_luasnip": { "branch": "master", "commit": "98d9cb5c2c38532bd9bdb481067b20fea8f32e90" }, "copilot.vim": { "branch": "release", "commit": "87038123804796ca7af20d1b71c3428d858a9124" }, + "dashboard-nvim": { "branch": "master", "commit": "000448d837f6e7a47f8f342f29526c4d7e49e9ce" }, "friendly-snippets": { "branch": "main", "commit": "efff286dd74c22f731cdec26a70b46e5b203c619" }, "github-theme": { "branch": "main", "commit": "c106c9472154d6b2c74b74565616b877ae8ed31d" }, "indent-blankline.nvim": { "branch": "master", "commit": "e10626f7fcd51ccd56d7ffc00883ba7e0aa28f78" }, @@ -34,6 +35,7 @@ "nvim-web-devicons": { "branch": "master", "commit": "aafa5c187a15701a7299a392b907ec15d9a7075f" }, "omnisharp-extended-lsp.nvim": { "branch": "main", "commit": "ec1a2431f8872f650a85ed71c24f0715df2e49c2" }, "onedarkpro.nvim": { "branch": "main", "commit": "44775f8206ee43b692e7f3dc894ddc47996ee523" }, + "persistence.nvim": { "branch": "main", "commit": "f6aad7dde7fcf54148ccfc5f622c6d5badd0cc3d" }, "plenary.nvim": { "branch": "master", "commit": "3707cdb1e43f5cea73afb6037e6494e7ce847a66" }, "rainbow-delimiters.nvim": { "branch": "master", "commit": "85b80abaa09cbbc039e3095b2f515b3cf8cadd11" }, "telescope-themes": { "branch": "main", "commit": "9b7c368b83b82b53c0a6e9e977f8329e5f1fe269" }, diff --git a/lua/plugins/dashboard.lua b/lua/plugins/dashboard.lua new file mode 100644 index 0000000..0179daf --- /dev/null +++ b/lua/plugins/dashboard.lua @@ -0,0 +1,71 @@ +return { + "nvimdev/dashboard-nvim", + event = "VimEnter", + config = function() + local logo = [[ + + + + + ███▄ █ ▒█████ ▒█████ ███▄ █ ▓█████ ▄████▄ ▄▄▄ ██▀███ ▓█████ ██████ + ██ ▀█ █ ▒██▒ ██▒ ▒██▒ ██▒ ██ ▀█ █ ▓█ ▀ ▒██▀ ▀█ ▒████▄ ▓██ ▒ ██▒▓█ ▀ ▒██ ▒ + ▓██ ▀█ ██▒▒██░ ██▒ ▒██░ ██▒▓██ ▀█ ██▒▒███ ▒▓█ ▄ ▒██ ▀█▄ ▓██ ░▄█ ▒▒███ ░ ▓██▄ + ▓██▒ ▐▌██▒▒██ ██░ ▒██ ██░▓██▒ ▐▌██▒▒▓█ ▄ ▒▓▓▄ ▄██▒░██▄▄▄▄██ ▒██▀▀█▄ ▒▓█ ▄ ▒ ██▒ + ▒██░ ▓██░░ ████▓▒░ ░ ████▓▒░▒██░ ▓██░░▒████▒ ▒ ▓███▀ ░ ▓█ ▓██▒░██▓ ▒██▒░▒████▒▒██████▒▒ + + █ █░ ▒█████ ██▀███ ██ ▄█▀ ██░ ██ ▄▄▄ ██▀███ ▓█████▄ ▓█████ ██▀███ + ▓█░ █ ░█░▒██▒ ██▒▓██ ▒ ██▒ ██▄█▒ ▓██░ ██▒▒████▄ ▓██ ▒ ██▒▒██▀ ██▌▓█ ▀ ▓██ ▒ ██▒ + ▒█░ █ ░█ ▒██░ ██▒▓██ ░▄█ ▒▓███▄░ ▒██▀▀██░▒██ ▀█▄ ▓██ ░▄█ ▒░██ █▌▒███ ▓██ ░▄█ ▒ + ░█░ █ ░█ ▒██ ██░▒██▀▀█▄ ▓██ █▄ ░▓█ ░██ ░██▄▄▄▄██ ▒██▀▀█▄ ░▓█▄ ▌▒▓█ ▄ ▒██▀▀█▄ + ░░██▒██▓ ░ ████▓▒░░██▓ ▒██▒▒██▒ █▄ ░▓█▒░██▓ ▓█ ▓██▒░██▓ ▒██▒░▒████▓ ░▒████▒░██▓ ▒██▒ + + + + + ]] + + local opts = { + theme = "doom", + hide = { + statusline = false, + }, + config = { + header = vim.split(logo, "\n"), + center = { + { action = 'lua require("telescope.builtin").find_files()', desc = " Find File", icon = " ", key = "f" }, + { action = "ene | startinsert", desc = " New File", icon = " ", key = "n" }, + { action = 'lua require("telescope.builtin").oldfiles()', desc = " Recent Files", icon = " ", key = "r" }, + { action = 'lua require("telescope.builtin").live_grep()', desc = " Find Text", icon = " ", key = "g" }, + { + action = 'lua require("persistence").load()', + desc = " Restore Session", + icon = " ", + key = "s", + }, + { action = "Lazy", desc = " Lazy", icon = "󰒲 ", key = "l" }, + { + action = function() + vim.api.nvim_input("qa") + 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, + }, + } + + require("dashboard").setup(opts) + + for _, button in ipairs(opts.config.center) do + button.desc = button.desc .. string.rep(" ", 43 - #button.desc) + button.key_format = " %s" + end + + end, +} diff --git a/lua/plugins/persistance.lua b/lua/plugins/persistance.lua new file mode 100644 index 0000000..3c54b6d --- /dev/null +++ b/lua/plugins/persistance.lua @@ -0,0 +1,23 @@ +return { + "folke/persistence.nvim", + event = "BufReadPre", + config = function() + local persistence = require("persistence") + + persistence.setup({ + dir = vim.fn.stdpath("data") .. "/sessions/", + need = 1, + branch = true, + }) + + vim.keymap.set("n", "qs", persistence.load, { desc = "Load session for the current directory" }) + + vim.keymap.set("n", "qS", persistence.select, { desc = "Select session to load" }) + + vim.keymap.set("n", "ql", function() + require("persistence").load({ last = true }) + end, { desc = "Load last session" }) + + vim.keymap.set("n", "qd", persistence.stop, { desc = "Stop Persistence" }) + end, +} diff --git a/lua/plugins/treesitter.lua b/lua/plugins/treesitter.lua index a710bcb..32edbb4 100644 --- a/lua/plugins/treesitter.lua +++ b/lua/plugins/treesitter.lua @@ -15,7 +15,6 @@ return { "lukas-reineke/indent-blankline.nvim", main = "ibl", config = function() - local highlight = { "RainbowRed", "RainbowYellow", @@ -40,7 +39,10 @@ return { vim.g.rainbow_delimiters = { highlight = highlight } - require("ibl").setup({ scope = { highlight = highlight } }) + require("ibl").setup({ + scope = { highlight = highlight }, + exclude = { filetypes = { "dashboard" } }, + }) hooks.register(hooks.type.SCOPE_HIGHLIGHT, hooks.builtin.scope_highlight_from_extmark) end,