From 71749db56671dda1de18f7abb0ae7c741f5fbccb Mon Sep 17 00:00:00 2001 From: Christoph Urlacher Date: Thu, 19 Jun 2025 16:48:28 +0200 Subject: [PATCH] Modules/Neovim: Replace dashboard-nvim with Snacks.dashboard --- home/modules/neovim/default.nix | 144 ++++++++++++++------------------ 1 file changed, 65 insertions(+), 79 deletions(-) diff --git a/home/modules/neovim/default.nix b/home/modules/neovim/default.nix index 166f7c2b..f4424f26 100644 --- a/home/modules/neovim/default.nix +++ b/home/modules/neovim/default.nix @@ -582,83 +582,6 @@ in { lazy = false; }; - dashboard = rec { - name = "dashboard"; - pkg = pkgs.vimPlugins.dashboard-nvim; - dependencies = [ - web-devicons - _persisted - ]; - lazy = false; - config = mkDefaultConfig name; - opts = { - theme = "doom"; - disable_move = true; - shortcut_type = "number"; - - config = { - center = [ - { - action = "Telescope persisted"; - desc = " Restore Session"; - icon = " "; - key = "s"; - } - { - action = "Telescope find_files"; - desc = " Find File"; - icon = " "; - key = "f"; - } - { - action = "Telescope oldfiles"; - desc = " Recent Files"; - icon = " "; - key = "r"; - } - { - action = "ObsidianSearch"; - desc = " Obsidian Note"; - icon = " "; - key = "o"; - } - { - action = "ene | startinsert"; - desc = " New File"; - icon = " "; - key = "n"; - } - { - action = "Telescope live_grep"; - desc = " Find Text"; - icon = " "; - key = "g"; - } - { - action = "Lazy"; - desc = " Lazy"; - icon = "󰒲 "; - key = "l"; - } - { - action = "quitall"; - desc = " Quit"; - icon = " "; - key = "q"; - } - ]; - - footer.__raw = '' - 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, - ''; - }; - }; - }; - diffview = { name = "diffview"; pkg = pkgs.vimPlugins.diffview-nvim; @@ -1561,6 +1484,10 @@ in { snacks = rec { name = "snacks"; pkg = pkgs.vimPlugins.snacks-nvim; + dependencies = [ + web-devicons + _persisted + ]; lazy = false; priority = 1000; config = mkDefaultConfig name; @@ -1572,6 +1499,67 @@ in { size = 1.5 * 1024 * 1024; # 1.5MB line_length = 1000; }; + + dashboard = { + enabled = true; + + 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 = "g"; + desc = "Find Text"; + action = "lua Snacks.dashboard.pick('live_grep')"; + } + { + icon = " "; + key = "r"; + desc = "Recent Files"; + action = "lua Snacks.dashboard.pick('oldfiles')"; + } + { + icon = " "; + key = "s"; + desc = "Restore Session"; + action = "Telescope persisted"; + } + { + icon = "󰒲 "; + key = "L"; + desc = "Lazy"; + action = "Lazy"; + } + { + icon = " "; + key = "q"; + desc = "Quit"; + action = "quitall"; + } + ]; + + sections = [ + {section = "header";} + { + section = "keys"; + gap = 1; + padding = 1; + } + {section = "startup";} + ]; + }; + }; }; }; @@ -2110,8 +2098,6 @@ in { # dadbod # Database interface # TODO: # dadbod-ui # Dadbod UI # TODO: - dashboard # Dashboard when starting nvim - # dap # Debug adapter protocol # TODO: # dap-ui # Debugger UI # TODO: diffview # Git diff # TODO: Check the keybindings