aboutsummaryrefslogtreecommitdiff
path: root/.config/nvim/lua/plugins/alpha.lua
diff options
context:
space:
mode:
authorJustine Smithies <justine@smithies.me.uk>2025-02-01 15:54:42 +0000
committerJustine Smithies <justine@smithies.me.uk>2025-02-01 15:54:42 +0000
commit6fe6bd334f8c006e6fc8fdf0c8a9a4181000be13 (patch)
tree4c91fcc95664ff640b6b926b7b0cbc9258f9ca7a /.config/nvim/lua/plugins/alpha.lua
parent3fe8cfadba3c095565d30710be5e281780966e78 (diff)
Initial commit of my revamped Neovim config
Diffstat (limited to '.config/nvim/lua/plugins/alpha.lua')
-rw-r--r--.config/nvim/lua/plugins/alpha.lua125
1 files changed, 125 insertions, 0 deletions
diff --git a/.config/nvim/lua/plugins/alpha.lua b/.config/nvim/lua/plugins/alpha.lua
new file mode 100644
index 0000000..acec7c6
--- /dev/null
+++ b/.config/nvim/lua/plugins/alpha.lua
@@ -0,0 +1,125 @@
+return {
+ "goolord/alpha-nvim",
+ event = "VimEnter",
+ config = function()
+local dashboard = require('alpha.themes.dashboard')
+local fortune = require('alpha.fortune')
+
+local logo = {
+ type = 'text',
+ val = {
+ ' ',
+ ' ███╗ ██╗███████╗ ██████╗ ██╗ ██╗██╗███╗ ███╗ ',
+ ' ████╗ ██║██╔════╝██╔═══██╗██║ ██║██║████╗ ████║ ',
+ ' ██╔██╗ ██║█████╗ ██║ ██║██║ ██║██║██╔████╔██║ ',
+ ' ██║╚██╗██║██╔══╝ ██║ ██║╚██╗ ██╔╝██║██║╚██╔╝██║ ',
+ ' ██║ ╚████║███████╗╚██████╔╝ ╚████╔╝ ██║██║ ╚═╝ ██║ ',
+ ' ╚═╝ ╚═══╝╚══════╝ ╚═════╝ ╚═══╝ ╚═╝╚═╝ ╚═╝ ',
+ },
+ opts = {
+ position = 'center',
+ hl = 'DevIconDart',
+ },
+}
+
+local function info_value()
+ local total_plugins = " Total plugins " .. vim.fn.len(vim.fn.globpath("~/.local/share/nvim/lazy", "*", 0, 1))
+ local datetime = os.date(' %d-%m-%Y')
+ local version = vim.version()
+ local nvim_version_info = '  v' .. version.major .. '.' .. version.minor .. '.' .. version.patch
+
+ return datetime .. nvim_version_info .. ' ' .. total_plugins
+end
+
+local info = {
+ type = 'text',
+ val = info_value(),
+ opts = {
+ hl = 'DevIconVimrc',
+ position = 'center',
+ },
+}
+
+local message = {
+ type = 'text',
+ val = fortune({ max_width = 60 }),
+ opts = {
+ position = 'center',
+ hl = 'SpecialComment',
+ },
+}
+
+local header = {
+ type = 'group',
+ val = {
+ logo,
+ info,
+ },
+}
+
+local buttons = {
+ type = 'group',
+ val = {
+ {
+ type = 'text',
+ val = 'Actions',
+ opts = {
+ hl = 'String',
+ shrink_margin = false,
+ position = 'center',
+ },
+ },
+ { type = 'padding', val = 1 },
+ dashboard.button("f", " " .. " Find file", ":Telescope find_files hidden=true no_ignore=true <CR>"),
+ dashboard.button("e", " " .. " New file", ":ene <BAR> startinsert <CR>"),
+ dashboard.button("r", " " .. " Recent files", ":Telescope oldfiles <CR>"),
+ dashboard.button("t", " " .. " Find text", "<cmd>lua require('telescope.builtin').live_grep({shorten_path=true})<CR>"),
+ dashboard.button(
+ 'd',
+ ' Dotfiles',
+ "<cmd>lua require('telescope.builtin').find_files({ search_dirs = { os.getenv('HOME') .. '/.config' } })<CR>"
+ ),
+ dashboard.button("l", " " .. " Lazy plugins", ":Lazy<CR>"),
+ dashboard.button("q", " " .. " Quit", ":qa<CR>"),
+ },
+ opts = {
+ position = 'center',
+ },
+}
+
+local config = {
+ layout = {
+ { type = 'padding', val = 5 },
+ header,
+ { type = 'padding', val = 2 },
+ buttons,
+ { type = 'padding', val = 1 },
+ message,
+ },
+ opts = {
+ setup = function()
+ vim.api.nvim_create_autocmd('User', {
+ pattern = 'AlphaReady',
+ desc = 'disable status, tabline and cmdline for alpha',
+ callback = function()
+ vim.go.laststatus = 0
+ vim.opt.showtabline = 0
+ vim.opt.cmdheight = 0
+ end,
+ })
+ vim.api.nvim_create_autocmd('BufUnload', {
+ buffer = 0,
+ desc = 'enable status, tabline and cmdline after alpha',
+ callback = function()
+ vim.go.laststatus = 2
+ vim.opt.showtabline = 2
+ vim.opt.cmdheight = 1
+ end,
+ })
+ end,
+ margin = 5,
+ },
+}
+ require("alpha").setup(config)
+ end,
+}