diff --git a/lua/znvim/plugins/editor.lua b/lua/znvim/plugins/editor.lua index 5081837..c63ac0f 100644 --- a/lua/znvim/plugins/editor.lua +++ b/lua/znvim/plugins/editor.lua @@ -1,5 +1,4 @@ return { - { -- use bdelete instead "https://github.com/famiu/bufdelete.nvim", config = function() @@ -14,6 +13,7 @@ return { local fallback_on_empty = fallback_name == "" and fallback_ft == "" if fallback_on_empty then require("neo-tree").close_all() + vim.cmd("Alpha") vim.cmd(event.buf .. "bwipeout") end end, @@ -24,7 +24,6 @@ return { { "bD", "Bdelete!", desc = "delete buffer!" }, }, }, - { -- neo-tree file explorer "https://github.com/nvim-neo-tree/neo-tree.nvim", cmd = "Neotree", @@ -125,7 +124,6 @@ return { telescope.load_extension("notify") end, }, - { -- a fast motion inside a visible area "https://github.com/ggandor/leap.nvim", event = "BufReadPre", @@ -143,7 +141,6 @@ return { buffer_leader_key = 'h', } }, - { -- displays a popup with possible key bindings "https://github.com/folke/which-key.nvim", event = "VeryLazy", @@ -155,11 +152,13 @@ return { spec = { { "b", group = "buffer" }, { "g", group = "git" }, + { "gd", group = "diff" }, { "gr", group = "reset" }, { "gs", group = "stage" }, { "gt", group = "toggle" }, { "t", group = "telescope" }, { "u", group = "ui" }, + { "x", group = "diagnostics" }, }, }, }, @@ -245,5 +244,4 @@ return { event = "BufReadPost", config = true, }, - } diff --git a/lua/znvim/plugins/ui.lua b/lua/znvim/plugins/ui.lua index 98c995a..7602100 100644 --- a/lua/znvim/plugins/ui.lua +++ b/lua/znvim/plugins/ui.lua @@ -1,4 +1,65 @@ return { + { -- dashboard + -- https://github.com/goolord/alpha-nvim/discussions/16 + "goolord/alpha-nvim", + event = "VimEnter", + opts = function() + local dashboard = require("alpha.themes.dashboard") + local logo = [[ +███╗ ██╗███████╗ ██████╗ ██╗ ██╗██╗███╗ ███╗ +████╗ ██║██╔════╝██╔═══██╗██║ ██║██║████╗ ████║ +██╔██╗ ██║█████╗ ██║ ██║██║ ██║██║██╔████╔██║ +██║╚██╗██║██╔══╝ ██║ ██║╚██╗ ██╔╝██║██║╚██╔╝██║ +██║ ╚████║███████╗╚██████╔╝ ╚████╔╝ ██║██║ ╚═╝ ██║ +╚═╝ ╚═══╝╚══════╝ ╚═════╝ ╚═══╝ ╚═╝╚═╝ ╚═╝ + ]] + + dashboard.section.header.val = vim.split(logo, "\n") + 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("g", " " .. " Find text", "Telescope live_grep "), + 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.footer.opts.hl = "Type" + dashboard.section.header.opts.hl = "AlphaHeader" + dashboard.section.buttons.opts.hl = "AlphaButtons" + dashboard.opts.layout[1].val = 8 + return dashboard + end, + config = function(_, dashboard) + vim.b.miniindentscope_disable = true + + -- close Lazy and re-open when the dashboard is ready + if vim.o.filetype == "lazy" then + vim.cmd.close() + vim.api.nvim_create_autocmd("User", { + pattern = "AlphaReady", + callback = function() + require("lazy").show() + end, + }) + end + + require("alpha").setup(dashboard.opts) + + vim.api.nvim_create_autocmd("User", { + pattern = "LazyVimStarted", + callback = function() + local stats = require("lazy").stats() + local ms = (math.floor(stats.startuptime * 100 + 0.5) / 100) + dashboard.section.footer.val = "⚡ Neovim loaded " .. stats.count .. " plugins in " .. ms .. "ms" + pcall(vim.cmd.AlphaRedraw) + end, + }) + end, + }, { -- notification popups "https://github.com/rcarriga/nvim-notify",