From 2b1f817f2b520544986ad583f39ea4b3cf62ac30 Mon Sep 17 00:00:00 2001 From: punkfairie Date: Sat, 30 Nov 2024 11:08:42 -0800 Subject: [PATCH] feat: Switch to alpha.nvim --- nix/neovim-overlay.nix | 5 ++- nvim/lua/plugins/ui/alpha-nvim.lua | 53 +++++++++++++++++++++++ nvim/lua/plugins/ui/dashboard-nvim.lua | 60 -------------------------- nvim/lua/plugins/ui/init.lua | 2 +- nvim/lua/plugins/util/init.lua | 5 +++ nvim/lua/plugins/util/plenary.lua | 4 ++ 6 files changed, 67 insertions(+), 62 deletions(-) create mode 100644 nvim/lua/plugins/ui/alpha-nvim.lua delete mode 100644 nvim/lua/plugins/ui/dashboard-nvim.lua create mode 100644 nvim/lua/plugins/util/init.lua create mode 100644 nvim/lua/plugins/util/plenary.lua diff --git a/nix/neovim-overlay.nix b/nix/neovim-overlay.nix index 5b30fc7..9b19285 100644 --- a/nix/neovim-overlay.nix +++ b/nix/neovim-overlay.nix @@ -33,9 +33,12 @@ with final.pkgs.lib; let lz-n snacks-nvim + # Util + plenary-nvim + # UI mini-icons - dashboard-nvim + alpha-nvim bufferline-nvim ]; diff --git a/nvim/lua/plugins/ui/alpha-nvim.lua b/nvim/lua/plugins/ui/alpha-nvim.lua new file mode 100644 index 0000000..209337d --- /dev/null +++ b/nvim/lua/plugins/ui/alpha-nvim.lua @@ -0,0 +1,53 @@ +return { + 'alpha-nvim', + before = function() + require('lz.n').trigger_load('plenary.nvim') + require('lz.n').trigger_load('mini.icons') + end, + after = function() + local theta = require('alpha.themes.theta') + + local header = [[ +███╗ ███╗ █████╗ ██████╗ ██╗ ███████╗██╗ ██╗██╗ ██╗██╗███╗ ███╗ +████╗ ████║██╔══██╗██╔══██╗██║ ██╔════╝╚██╗ ██╔╝██║ ██║██║████╗ ████║ +██╔████╔██║███████║██████╔╝██║ █████╗ ╚████╔╝ ██║ ██║██║██╔████╔██║ +██║╚██╔╝██║██╔══██║██╔══██╗██║ ██╔══╝ ╚██╔╝ ╚██╗ ██╔╝██║██║╚██╔╝██║ +██║ ╚═╝ ██║██║ ██║██║ ██║███████╗███████╗ ██║ ╚████╔╝ ██║██║ ╚═╝ ██║ +╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚══════╝ ╚═╝ ╚═══╝ ╚═╝╚═╝ ╚═╝ + ]] + + theta.header.val = vim.split(header, '\n') + + local button = require('alpha.themes.dashboard').button + theta.buttons.val = { + { + type = 'text', + val = 'Shortcuts', + opts = { hl = 'SpecialComment', position = 'center' }, + }, + { type = 'padding', val = 1 }, + + button( + 'f', + '󰈞 Find file', + 'lua require("telescope").builtin.fd()' + ), + + button( + 'g', + ' Live grep', + 'lua require("telescope").builtin.live_grep()' + ), + + button( + 's', + ' Restore session', + 'lua require("persistence").load()' + ), + + button('q', ' Quit', 'qa'), + } + + require('alpha').setup(theta.config) + end, +} diff --git a/nvim/lua/plugins/ui/dashboard-nvim.lua b/nvim/lua/plugins/ui/dashboard-nvim.lua deleted file mode 100644 index 62508d4..0000000 --- a/nvim/lua/plugins/ui/dashboard-nvim.lua +++ /dev/null @@ -1,60 +0,0 @@ -return { - 'dashboard-nvim', - event = 'VimEnter', - before = function() - require('lz.n').trigger_load('mini.icons') - end, - after = function() - local icons = require('icons').dashboard - - local title = [[ - ███╗ ███╗ █████╗ ██████╗ ██╗ ███████╗██╗ ██╗██╗ ██╗██╗███╗ ███╗ - ████╗ ████║██╔══██╗██╔══██╗██║ ██╔════╝╚██╗ ██╔╝██║ ██║██║████╗ ████║ - ██╔████╔██║███████║██████╔╝██║ █████╗ ╚████╔╝ ██║ ██║██║██╔████╔██║ - ██║╚██╔╝██║██╔══██║██╔══██╗██║ ██╔══╝ ╚██╔╝ ╚██╗ ██╔╝██║██║╚██╔╝██║ - ██║ ╚═╝ ██║██║ ██║██║ ██║███████╗███████╗ ██║ ╚████╔╝ ██║██║ ╚═╝ ██║ - ╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═╝╚══════╝╚══════╝ ╚═╝ ╚═══╝ ╚═╝╚═╝ ╚═╝ - ]] - - title = string.rep('\n', 8) .. title .. '\n\n' - - require('dashboard').setup({ - theme = 'hyper', - shortcut_type = 'number', - change_to_vcs_root = true, - hide = { - -- This is taken care of by Lualine. - statusline = false, - tabline = true, - }, - - config = { - header = vim.split(title, '\n'), - - shortcut = { - { - icon = icons.quit .. ' ', - desc = 'Quit', - key = 'q', - action = function() - vim.api.nvim_input('qa') - end, - }, - }, - - mru = { - enable = true, - limit = 5, - icon = icons.mru .. ' ', - label = 'Files', - }, - project = { - enable = true, - limit = 5, - icon = icons.project .. ' ', - label = 'Projects', - }, - }, - }) - end, -} diff --git a/nvim/lua/plugins/ui/init.lua b/nvim/lua/plugins/ui/init.lua index 3427523..2f0e08e 100644 --- a/nvim/lua/plugins/ui/init.lua +++ b/nvim/lua/plugins/ui/init.lua @@ -1,7 +1,7 @@ local req = require('lib.marleyvim').localRequire('plugins.ui') return { + req('alpha-nvim'), req('bufferline-nvim'), - req('dashboard-nvim'), req('mini-icons'), } diff --git a/nvim/lua/plugins/util/init.lua b/nvim/lua/plugins/util/init.lua new file mode 100644 index 0000000..69fc0eb --- /dev/null +++ b/nvim/lua/plugins/util/init.lua @@ -0,0 +1,5 @@ +local req = require('lib.marleyvim').localRequire('plugins.util') + +return { + req('plenary'), +} diff --git a/nvim/lua/plugins/util/plenary.lua b/nvim/lua/plugins/util/plenary.lua new file mode 100644 index 0000000..5694110 --- /dev/null +++ b/nvim/lua/plugins/util/plenary.lua @@ -0,0 +1,4 @@ +return { + 'plenary.nvim', + lazy = true, +}