From 6c63df91724e4c2c8c582861350766fd8b39ee4b Mon Sep 17 00:00:00 2001 From: Micah Halter Date: Fri, 4 Oct 2024 14:15:46 -0400 Subject: [PATCH] feat(pack): add an NvChad UI pack (#1230) --- lua/astrocommunity/pack/nvchad-ui/README.md | 5 + lua/astrocommunity/pack/nvchad-ui/init.lua | 198 ++++++++++++++++++++ 2 files changed, 203 insertions(+) create mode 100644 lua/astrocommunity/pack/nvchad-ui/README.md create mode 100644 lua/astrocommunity/pack/nvchad-ui/init.lua diff --git a/lua/astrocommunity/pack/nvchad-ui/README.md b/lua/astrocommunity/pack/nvchad-ui/README.md new file mode 100644 index 000000000..2637852a9 --- /dev/null +++ b/lua/astrocommunity/pack/nvchad-ui/README.md @@ -0,0 +1,5 @@ +# NvChad/ui + +Lightweight & high performance UI plugin for nvchad + +**Repository:** diff --git a/lua/astrocommunity/pack/nvchad-ui/init.lua b/lua/astrocommunity/pack/nvchad-ui/init.lua new file mode 100644 index 000000000..a76431b36 --- /dev/null +++ b/lua/astrocommunity/pack/nvchad-ui/init.lua @@ -0,0 +1,198 @@ +return { + "NvChad/ui", + lazy = false, + opts = { + base46 = { theme = "onedark" }, + nvdash = { + header = { + " █████ ███████ ████████ ██████ ██████", + "██ ██ ██ ██ ██ ██ ██ ██", + "███████ ███████ ██ ██████ ██ ██", + "██ ██ ██ ██ ██ ██ ██ ██", + "██ ██ ███████ ██ ██ ██ ██████", + " ", + " ███ ██ ██ ██ ██ ███ ███", + " ████ ██ ██ ██ ██ ████ ████", + " ██ ██ ██ ██ ██ ██ ██ ████ ██", + " ██ ██ ██ ██ ██ ██ ██ ██ ██", + " ██ ████ ████ ██ ██ ██", + "", + "", + "", + }, + + buttons = { + { txt = " Find File", keys = "Spc f f", cmd = "Telescope find_files" }, + { txt = " Recent Files", keys = "Spc f o", cmd = "Telescope oldfiles" }, + { txt = "󰈭 Find Word", keys = "Spc f w", cmd = "Telescope live_grep" }, + { txt = "󱥚 Themes", keys = "Spc f t", cmd = ":lua require('nvchad.themes').open()" }, + { txt = " Last Session", keys = "Spc S l", cmd = "NvCheatsheet" }, + + { txt = "─", hl = "NvDashLazy", no_gap = true, rep = true }, + + { + txt = function() + local stats = require("lazy").stats() + local ms = math.floor(stats.startuptime) .. " ms" + return " Loaded " .. stats.loaded .. "/" .. stats.count .. " plugins in " .. ms + end, + hl = "NvDashLazy", + no_gap = true, + }, + + { txt = "─", hl = "NvDashLazy", no_gap = true, rep = true }, + }, + }, + }, + init = function() + -- load the lazy opts on module load + package.preload["chadrc"] = function() + local plugin = require("lazy.core.config").spec.plugins["ui"] + return require("lazy.core.plugin").values(plugin, "opts", false) + end + end, + config = function() + pcall(function() + dofile(vim.g.base46_cache .. "defaults") + dofile(vim.g.base46_cache .. "statusline") + end) + require "nvchad" + end, + specs = { + { + "hrsh7th/nvim-cmp", + optional = true, + opts = function(_, opts) return vim.tbl_deep_extend("force", opts, require "nvchad.cmp") end, + }, + { + "AstroNvim/astrocore", + opts = { + options = { opt = { showtabline = 0 } }, + mappings = { + n = { + ["h"] = { + function() + local is_valid_win = function(win) + local bufnr = vim.api.nvim_win_get_buf(win) + return require("astrocore.buffer").is_valid(bufnr) or vim.bo[bufnr].filetype == "alpha" + end + local cur_win = vim.api.nvim_get_current_win() + -- try to find the most suitable window for Alpha + if not is_valid_win(cur_win) then + for _, win in ipairs(vim.api.nvim_tabpage_list_wins(0)) do + if win ~= cur_win and is_valid_win(win) then + vim.fn.win_gotoid(win) + break + end + end + end + require("nvchad.nvdash").open() + end, + desc = "Home Screen", + }, + ["ft"] = { function() require("nvchad.themes").open() end, desc = "Find themes" }, + }, + }, + }, + }, + -- Disable unnecessary plugins + { "rebelot/heirline.nvim", opts = { statusline = false, tabline = false } }, + { "goolord/alpha-nvim", enabled = false }, + { "brenoprata10/nvim-highlight-colors", enabled = false }, + { "NvChad/nvim-colorizer.lua", enabled = false }, + -- add lazy loaded dependencies + { "nvim-lua/plenary.nvim", lazy = true }, + { "NvChad/volt", lazy = true }, + { "NvChad/minty", lazy = true }, + { "NvChad/menu", lazy = true }, + { + "NvChad/base46", + lazy = true, + init = function() vim.g.base46_cache = vim.fn.stdpath "data" .. "/base46_cache/" end, + build = function() require("base46").load_all_highlights() end, + -- load base46 cache when necessary + specs = { + { + "nvim-treesitter/nvim-treesitter", + optional = true, + opts = function() + pcall(function() + dofile(vim.g.base46_cache .. "syntax") + dofile(vim.g.base46_cache .. "treesitter") + end) + end, + }, + { + "folke/which-key.nvim", + optional = true, + opts = function() + pcall(function() dofile(vim.g.base46_cache .. "whichkey") end) + end, + }, + { + "lukas-reineke/indent-blankline.nvim", + optional = true, + opts = function() + pcall(function() dofile(vim.g.base46_cache .. "blankline") end) + end, + }, + { + "nvim-telescope/telescope.nvim", + optional = true, + opts = function() + pcall(function() dofile(vim.g.base46_cache .. "telescope") end) + end, + }, + { + "neovim/nvim-lspconfig", + optional = true, + opts = function() + pcall(function() dofile(vim.g.base46_cache .. "lsp") end) + end, + }, + { + "nvim-tree/nvim-tree.lua", + optional = true, + opts = function() + pcall(function() dofile(vim.g.base46_cache .. "nvimtree") end) + end, + }, + { + "williamboman/mason.nvim", + optional = true, + opts = function() + pcall(function() dofile(vim.g.base46_cache .. "mason") end) + end, + }, + { + "lewis6991/gitsigns.nvim", + optional = true, + opts = function() + pcall(function() dofile(vim.g.base46_cache .. "git") end) + end, + }, + { + "nvim-tree/nvim-web-devicons", + optional = true, + opts = function() + pcall(function() dofile(vim.g.base46_cache .. "devicons") end) + end, + }, + { + "echasnovski/mini.icons", + optional = true, + opts = function() + pcall(function() dofile(vim.g.base46_cache .. "devicons") end) + end, + }, + { + "hrsh7th/nvim-cmp", + optional = true, + opts = function() + pcall(function() dofile(vim.g.base46_cache .. "cmp") end) + end, + }, + }, + }, + }, +}