From 8f23e9faf5ec62f2d25701370e63041d67284625 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sergio=20La=C3=ADn?= Date: Sat, 25 Nov 2023 18:30:42 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix(nvim):=20alpha=20hardcoded?= =?UTF-8?q?=20function=20can=20now=20be=20overwrited?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../plugins/extras/editor/telescope/repo.lua | 9 ++++ .config/nvim/lua/plugins/extras/ui/alpha.lua | 52 ++----------------- 2 files changed, 14 insertions(+), 47 deletions(-) diff --git a/.config/nvim/lua/plugins/extras/editor/telescope/repo.lua b/.config/nvim/lua/plugins/extras/editor/telescope/repo.lua index d8fb9931..f112346f 100644 --- a/.config/nvim/lua/plugins/extras/editor/telescope/repo.lua +++ b/.config/nvim/lua/plugins/extras/editor/telescope/repo.lua @@ -32,6 +32,15 @@ return { }, }, }, + { + "goolord/alpha-nvim", + opts = function(_, dashboard) + local button = dashboard.button("p", " " .. " Projects/Repos", "Telescope repo list ") + button.opts.hl = "AlphaButtons" + button.opts.hl_shortcut = "AlphaShortcut" + table.insert(dashboard.section.buttons.val, 4, button) + end, + }, { "airblade/vim-rooter", event = "VeryLazy", diff --git a/.config/nvim/lua/plugins/extras/ui/alpha.lua b/.config/nvim/lua/plugins/extras/ui/alpha.lua index b06606bf..ebd6d85d 100644 --- a/.config/nvim/lua/plugins/extras/ui/alpha.lua +++ b/.config/nvim/lua/plugins/extras/ui/alpha.lua @@ -1,11 +1,9 @@ return { "goolord/alpha-nvim", - event = "VimEnter", keys = { { "fa", "Alpha", desc = "Dashboard (Alpha)" }, }, - opts = function() - local dashboard = require("alpha.themes.dashboard") + opts = function(_, dashboard) local logo = [[  ████ ██████ █████ ██ @@ -16,53 +14,13 @@ return { ███████████ ███ ███ █████████ █████ █████ ████ █████ ██████ █████████████████████ ████ █████ █████ ████ ██████ ]] - -- local logo = [[ - --  - -- ███████████ █████ ██ - -- ███████████ █████  - -- ████████████████ ███████████ ███ ███████ - -- ████████████████ ████████████ █████ ██████████████ - -- ██████████████ █████████████ █████ █████ ████ █████ - -- ██████████████████████████████████ █████ █████ ████ █████ - -- ██████ ███ █████████████████ ████ █████ █████ ████ ██████ - -- ]] - -- local logo = [[ - -- ▄ ▄ - -- ▄ ▄▄▄ ▄ ▄▄▄ ▄ ▄ - -- █ ▄ █▄█ ▄▄▄ █ █▄█ █ █ - -- ▄▄ █▄█▄▄▄█ █▄█▄█▄▄█▄▄█ █ - -- ▄ █▄▄█ ▄ ▄▄ ▄█ ▄▄▄▄▄▄▄▄▄▄▄▄▄▄ - -- █▄▄▄▄ ▄▄▄ █ ▄ ▄▄▄ ▄ ▄▄▄ ▄ ▄ █ ▄ - -- ▄ █ █▄█ █▄█ █ █ █▄█ █ █▄█ ▄▄▄ █ █ - -- █▄█ ▄ █▄▄█▄▄█ █ ▄▄█ █ ▄ █ █▄█▄█ █ - -- █▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄█ █▄█▄▄▄█ - -- ]] dashboard.section.header.val = vim.split(logo, "\n") -- stylua: ignore - dashboard.section.buttons.val = { - dashboard.button("f", " " .. " Find file", " Telescope find_files "), - dashboard.button("n", " " .. " New file", " ene startinsert "), - dashboard.button("r", " " .. " Recent files", " Telescope oldfiles "), - dashboard.button("p", " " .. " Projects/Repos", "Telescope repo list "), - dashboard.button("z", " " .. " Zoxide", "Telescope zoxide list "), - dashboard.button("g", " " .. " Find text", " Telescope live_grep "), - dashboard.button("G", "󰊢 " .. " Git", "FloatermNew --disposable --name=lazygitroot --opener=edit --titleposition=center --height=0.85 --width=0.85 --cwd= lazygit"), - dashboard.button("c", " " .. " Config", " lua require('lazyvim.util').telescope.config_files()() "), - dashboard.button("d", "󰉦 " .. " Dotfiles", "FloatermNew --disposable --name=dots --opener=edit --titleposition=center --height=0.85 --width=0.85 dots"), - dashboard.button("s", " " .. " Restore Session", [[ lua require("persistence").load() ]]), - dashboard.button("e", " " .. " Lazy Extras", " LazyExtras "), - dashboard.button("l", "󰒲 " .. " Lazy", " Lazy "), - dashboard.button("q", " " .. " Quit", " qa "), - } - for _, button in ipairs(dashboard.section.buttons.val) do - button.opts.hl = "AlphaButtons" - button.opts.hl_shortcut = "AlphaShortcut" - end - dashboard.section.header.opts.hl = "AlphaHeader" - dashboard.section.buttons.opts.hl = "AlphaButtons" - dashboard.section.footer.opts.hl = "AlphaFooter" - dashboard.opts.layout[1].val = 8 + local button = dashboard.button("G", "󰊢 " .. " Git", "FloatermNew --disposable --name=lazygitroot --opener=edit --titleposition=center --height=0.85 --width=0.85 --cwd= lazygit") + button.opts.hl = "AlphaButtons" + button.opts.hl_shortcut = "AlphaShortcut" + table.insert(dashboard.section.buttons.val, 7, button) return dashboard end, }