Selaa lähdekoodia

feat: add alpha.nvim integration (#1906)

kylo252 3 vuotta sitten
vanhempi
commit
c946ddda81

+ 1 - 0
README.md

@@ -143,6 +143,7 @@ lvim.plugins = {
 
 - `lvim.lang.FOO` is no longer supported. Refer to <https://www.lunarvim.org/languages> for up-to-date instructions.
 - `lvim.lsp.popup_border` has been deprecated in favor of `lvim.lsp.float.border` and `lvim.lsp.diagnostics.float.border`.
+- `lvim.builtin.dashboard` has been replaced with `lvim.builtin.alpha`, see <https://github.com/LunarVim/LunarVim/pull/1906>
 
 ## Resources
 

+ 26 - 5
lua/lvim/config/init.lua

@@ -40,20 +40,33 @@ function M:init()
   local lvim_lsp_config = require "lvim.lsp.config"
   lvim.lsp = apply_defaults(lvim.lsp, vim.deepcopy(lvim_lsp_config))
 
+  ---@deprecated replaced with lvim.builtin.alpha
+  lvim.builtin.dashboard = {
+    active = false,
+    on_config_done = nil,
+    search_handler = "",
+    disable_at_vim_enter = 0,
+    session_directory = "",
+    custom_header = {},
+    custom_section = {},
+    footer = {},
+  }
+
   require("lvim.lsp.manager").init_defaults()
 end
 
 local function handle_deprecated_settings()
-  local function deprecation_notice(setting)
+  local function deprecation_notice(setting, msg)
     local in_headless = #vim.api.nvim_list_uis() == 0
     if in_headless then
       return
     end
 
-    local msg = string.format(
-      "Deprecation notice: [%s] setting is no longer supported. See https://github.com/LunarVim/LunarVim#breaking-changes",
-      setting
-    )
+    msg = msg
+      or string.format(
+        "Deprecation notice: [%s] setting is no longer supported. See https://github.com/LunarVim/LunarVim#breaking-changes",
+        setting
+      )
     vim.schedule(function()
       Log:warn(msg)
     end)
@@ -71,6 +84,14 @@ local function handle_deprecated_settings()
   if vim.tbl_contains(vim.tbl_keys(lvim.lsp), "popup_border") then
     deprecation_notice "lvim.lsp.popup_border"
   end
+
+  -- dashboard.nvim
+  if lvim.builtin.dashboard.active then
+    deprecation_notice(
+      "dashboard",
+      "Deprecation notice: `lvim.builtin.dashboard` has been replaced with `lvim.builtin.alpha`. See LunarVim#1906"
+    )
+  end
 end
 
 --- Override the configuration with a user provided one

+ 62 - 0
lua/lvim/core/alpha.lua

@@ -0,0 +1,62 @@
+local M = {}
+
+function M.config()
+  local lvim_dashboard = require "lvim.core.alpha.dashboard"
+  local lvim_startify = require "lvim.core.alpha.startify"
+  lvim.builtin.alpha = {
+    dashboard = { config = {}, section = lvim_dashboard.get_sections() },
+    startify = { config = {}, section = lvim_startify.get_sections() },
+    active = true,
+    mode = "dashboard",
+  }
+end
+
+local function resolve_buttons(theme_name, entries)
+  local selected_theme = require("alpha.themes." .. theme_name)
+  local val = {}
+  for _, entry in pairs(entries) do
+    local on_press = function()
+      local sc_ = entry[1]:gsub("%s", ""):gsub("SPC", "<leader>")
+      local key = vim.api.nvim_replace_termcodes(sc_, true, false, true)
+      vim.api.nvim_feedkeys(key, "normal", false)
+    end
+    local button_element = selected_theme.button(entry[1], entry[2], entry[3])
+    -- this became necessary after recent changes in alpha.nvim (06ade3a20ca9e79a7038b98d05a23d7b6c016174)
+    button_element.on_press = on_press
+    table.insert(val, button_element)
+  end
+  return val
+end
+
+local function resolve_config(theme_name)
+  local selected_theme = require("alpha.themes." .. theme_name)
+  local resolved_section = selected_theme.section
+  local section = lvim.builtin.alpha[theme_name].section
+
+  for name, el in pairs(section) do
+    for k, v in pairs(el) do
+      if name:match "buttons" and k == "entries" then
+        resolved_section[name].val = resolve_buttons(theme_name, v)
+      elseif v then
+        resolved_section[name][k] = v
+      end
+    end
+  end
+
+  return selected_theme.config
+end
+
+function M.setup()
+  local alpha = require "alpha"
+  local mode = lvim.builtin.alpha.mode
+  local config = lvim.builtin.alpha[mode].config
+
+  -- this makes it easier to use a completely custom configuration
+  if vim.tbl_isempty(config) then
+    config = resolve_config(mode)
+  end
+
+  alpha.setup(config)
+end
+
+return M

+ 83 - 0
lua/lvim/core/alpha/dashboard.lua

@@ -0,0 +1,83 @@
+local M = {}
+
+function M.get_sections()
+  local header = {
+    type = "text",
+    val = {
+      "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀",
+      "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀",
+      "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣀⣤⣤⣶⣶⣶⣶⣶⣶⣶⣦⣤⣄⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀",
+      "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣠⣴⣾⣿⠿⠛⠛⠉⠉⠉⠉⠉⠉⠉⠙⠛⠻⢿⣿⣶⣤⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀",
+      "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣴⣿⠿⠛⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠻⢿⣷⣤⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀",
+      "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣴⣿⠟⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠙⢿⣿⣦⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀",
+      "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡠⠒⠈⠉⠉⠉⠉⠉⣹⣿⠟⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠙⢿⣷⡄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀",
+      "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠸⡀⠀⠀⠀⠀⠀⠀⣰⣿⠏⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⢿⣿⡄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀",
+      "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠑⢄⠀⠀⠀⠀⢰⣿⠏⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⢿⣿⡄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀",
+      "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠑⢄⡀⠀⣿⡟⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠘⣿⣧⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀",
+      "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⢺⣿⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⣿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀",
+      "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⣿⠉⠑⠢⢄⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⣿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀",
+      "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠘⣿⡇⠀⠀⠀⠈⠑⠢⠄⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⣿⠢⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀",
+      "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢿⣇⠀⠀⠀⠀⠀⠀⠀⠀⠉⠐⠢⠄⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢰⣿⡟⠀⠈⠑⡄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀",
+      "⠀⠀⠀⠀⠀⠀⢀⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠘⣿⡄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠁⠒⠠⠤⣀⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣾⣿⠁⠀⠀⢀⣼⣦⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀",
+      "⠀⠀⠀⠀⠀⠀⢸⣿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠹⣷⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠁⠒⠂⠤⠤⠀⣀⡀⠀⠀⠀⣼⣿⠇⠀⠀⢀⣸⣿⡿⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀",
+      "⠀⠀⠀⠀⠀⠀⣿⡟⠀⠀⠀⠀⠀⠀⣤⡄⠀⠀⠀⣠⣤⠀⠀⢠⣭⣀⣤⣤⣤⡀⠀⠀⠀⢀⣤⣤⣤⣤⡀⠀⠀⠀⢠⣤⢀⣤⣤⣄⠀⠀⣿⣿⠀⠉⣹⣿⠏⠉⠉⢱⣶⣶⣶⡦⠀⠀⠀⢠⣶⣦⣴⣦⣠⣴⣦⡀⠀⠀⠀⠀",
+      "⠀⠀⠀⠀⠀⢠⣿⡇⠀⠀⠀⠀⠀⢠⣿⠇⠀⠀⠀⣿⡇⠀⠀⣿⡿⠉⠀⠈⣿⣧⠀⠀⠰⠿⠋⠀⠀⢹⣿⠀⠀⠀⣿⡿⠋⠀⠹⠿⠀⠀⢻⣿⡇⢠⣿⡟⠀⠀⠀⠈⠉⢹⣿⡇⠀⠀⠀⢸⣿⡏⢹⣿⡏⢹⣿⡇⠀⠀⠀⠀",
+      "⠀⠀⠀⠀⠀⢸⣿⠀⠀⠀⠀⠀⠀⢸⣿⠀⠀⠀⢰⣿⠃⠀⢠⣿⡇⠀⠀⠀⣿⡇⠀⠀⣠⣴⡶⠶⠶⣿⣿⠀⠀⢠⣿⡇⠀⠀⠀⠀⠀⠀⢸⣿⣇⣿⡿⠀⠀⠀⠀⠀⠀⣿⣿⠁⠀⠀⠀⣿⣿⠀⣾⣿⠀⣾⣿⠁⠀⠀⠀⠀",
+      "⠀⠀⠀⠀⠀⣿⣟⠀⠀⠀⠀⠀⠀⢻⣿⡀⠀⢀⣼⣿⠀⠀⢸⣿⠀⠀⠀⢰⣿⠇⠀⢰⣿⣇⠀⠀⣠⣿⡏⠀⠀⢸⣿⠀⠀⠀⠀⠀⠀⠀⢸⣿⣿⣿⠁⠀⠀⠀⣀⣀⣠⣿⣿⣀⡀⠀⢠⣿⡟⢠⣿⡟⢀⣿⡿⠀⠀⠀⠀⠀",
+      "⠀⠀⠀⠀⠀⠛⠛⠛⠛⠛⠛⠁⠀⠈⠛⠿⠟⠋⠛⠃⠀⠀⠛⠛⠀⠀⠀⠘⠛⠀⠀⠀⠙⠿⠿⠛⠙⠛⠃⠀⠀⠚⠛⠀⠀⠀⠀⠀⠀⠀⠘⠿⠿⠃⠀⠀⠀⠀⠿⠿⠿⠿⠿⠿⠿⠀⠸⠿⠇⠸⠿⠇⠸⠿⠇⠀⠀⠀⠀⠀",
+      "                                                                                ",
+    },
+    opts = {
+      position = "center",
+      hl = "Label",
+    },
+  }
+
+  local text = require "lvim.interface.text"
+  local git_utils = require "lvim.utils.git"
+
+  local current_branch = git_utils.get_lvim_branch()
+
+  local lvim_version
+  if current_branch ~= "HEAD" or "" then
+    lvim_version = current_branch .. "-" .. git_utils.get_lvim_current_sha()
+  else
+    lvim_version = "v" .. git_utils.get_lvim_tag()
+  end
+
+  local footer = {
+    type = "text",
+    val = text.align_center({ width = 0 }, {
+      "",
+      "lunarvim.org",
+      lvim_version,
+    }, 0.5),
+    opts = {
+      position = "center",
+      hl = "Number",
+    },
+  }
+
+  local buttons = {
+    entries = {
+      { "SPC f", "  Find File", "<CMD>Telescope find_files<CR>" },
+      { "SPC n", "  New File", "<CMD>ene!<CR>" },
+      { "SPC P", "  Recent Projects ", "<CMD>Telescope projects<CR>" },
+      { "SPC s r", "  Recently Used Files", "<CMD>Telescope oldfiles<CR>" },
+      { "SPC s t", "  Find Word", "<CMD>Telescope live_grep<CR>" },
+      {
+        "SPC L c",
+        "  Configuration",
+        "<CMD>edit " .. require("lvim.config").get_user_config_path() .. " <CR>",
+      },
+    },
+  }
+
+  return {
+    header = header,
+    buttons = buttons,
+    footer = footer,
+  }
+end
+
+return M

+ 48 - 0
lua/lvim/core/alpha/startify.lua

@@ -0,0 +1,48 @@
+local M = {}
+
+function M.get_sections()
+  local header = {
+    type = "text",
+    val = {
+      [[    __                          _    ___         ]],
+      [[   / /   __  ______  ____ _____| |  / (_)___ ___ ]],
+      [[  / /   / / / / __ \/ __ `/ ___/ | / / / __ `__ \]],
+      [[ / /___/ /_/ / / / / /_/ / /   | |/ / / / / / / /]],
+      [[/_____/\__,_/_/ /_/\__,_/_/    |___/_/_/ /_/ /_/ ]],
+    },
+    opts = {
+      hl = "Label",
+      shrink_margin = false,
+      -- wrap = "overflow";
+    },
+  }
+
+  local top_buttons = {
+    entries = {
+      { "e", "  New File", "<CMD>ene!<CR>" },
+    },
+    val = {},
+  }
+
+  local bottom_buttons = {
+    entries = {
+      { "q", "Quit", "<CMD>quit<CR>" },
+    },
+    val = {},
+  }
+
+  local footer = {
+    type = "group",
+    val = {},
+  }
+
+  return {
+    header = header,
+    top_buttons = top_buttons,
+    bottom_buttons = bottom_buttons,
+    -- this is probably broken
+    footer = footer,
+  }
+end
+
+return M

+ 13 - 0
lua/lvim/core/autocmds.lua

@@ -53,6 +53,19 @@ function M.load_augroups()
     _general_lsp = {
       { "FileType", "lspinfo,lsp-installer,null-ls-info", "nnoremap <silent> <buffer> q :close<CR>" },
     },
+    _alpha = {
+      {
+        "FileType",
+        "alpha",
+        "set showtabline=0 | autocmd BufLeave <buffer> set showtabline=" .. vim.opt.showtabline._value,
+      },
+      -- https://github.com/goolord/alpha-nvim/issues/42
+      {
+        "FileType",
+        "alpha",
+        "set laststatus=0 | autocmd BufUnload <buffer> set laststatus=" .. vim.opt.laststatus._value,
+      },
+    },
     custom_groups = {},
   }
 end

+ 1 - 1
lua/lvim/core/builtins/init.lua

@@ -4,7 +4,6 @@ local builtins = {
   "lvim.core.which-key",
   "lvim.core.gitsigns",
   "lvim.core.cmp",
-  "lvim.core.dashboard",
   "lvim.core.dap",
   "lvim.core.terminal",
   "lvim.core.telescope",
@@ -16,6 +15,7 @@ local builtins = {
   "lvim.core.comment",
   "lvim.core.notify",
   "lvim.core.lualine",
+  "lvim.core.alpha",
 }
 
 function M.config(config)

+ 0 - 115
lua/lvim/core/dashboard.lua

@@ -1,115 +0,0 @@
-local M = {}
-local utils = require "lvim.utils"
-
-M.config = function(config)
-  lvim.builtin.dashboard = {
-    active = false,
-    on_config_done = nil,
-    search_handler = "telescope",
-    disable_at_vim_enter = 0,
-    session_directory = utils.join_paths(get_cache_dir(), "sessions"),
-    custom_header = {
-      "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣀⣀⣀⣀⣀⣀⣀⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀",
-      "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣠⣤⣶⣾⠿⠿⠟⠛⠛⠛⠛⠿⠿⣿⣷⣤⣄⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀",
-      "  ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣠⣾⡿⠋⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠙⠿⣷⣤⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀",
-      "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣤⡿⠛⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠛⢿⣦⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀",
-      "⠀⠀⠀⠀⠀⠀⠀⠀⠀⡠⠒⠂⠉⠉⠉⠉⢩⣿⡿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠹⣷⡄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀",
-      "⠀⠀⠀⠀⠀⠀⠀⠀⠸⡀⠀⠀⠀⠀⠀⢰⣿⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠙⣿⣧⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀",
-      "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠑⠠⡀⠀⠀⢀⣾⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠘⣿⡆⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀",
-      "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠢⢀⣸⡟⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢹⣇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀",
-      "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⡧⢄⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⣿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀",
-      "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⡇⠀⠈⠁⠒⠤⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⣿⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀",
-      "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⣇⠀⠀⠀⠀⠀⠀⠉⠢⠤⠀⢀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣸⡟⠈⠑⠄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀",
-      "⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢿⡄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠑⠒⠤⣀⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢠⣿⡇⠀⠀⢀⣣⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀",
-      "⠀⣿⡟⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠸⣷⡄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠀⠀⠒⠢⠤⠄⣀⣀⠀⠀⠀⢠⣿⡟⠀⠀⠀⣺⣿⡿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀",
-      "⠀⣿⠇⠀⠀⠀⠀⠀⣤⡄⠀⠀⢠⣤⡄⠀⢨⣭⣠⣤⣤⣤⡀⠀⠀⢀⣤⣤⣤⣤⡄⠀⠀⠀⣤⣄⣤⣤⣤⠀⠀⣿⣯⠉⠉⣿⡟⠀⠈⢩⣭⣤⣤⠀⠀⠀⠀⣠⣤⣤⣤⣄⣤⣤",
-      "⢠⣿⠀⠀⠀⠀⠀⠀⣿⠃⠀⠀⣸⣿⠁⠀⣿⣿⠉⠀⠈⣿⡇⠀⠀⠛⠋⠀⠀⢹⣿⠀⠀⠀⣿⠏⠀⠸⠿⠃⠀⣿⣿⠀⣰⡟⠀⠀⠀⠀⠀⢸⣿⠀⠀⠀⠀⣿⡟⢸⣿⡇⢀⣿",
-      "⣸⡇⠀⠀⠀⠀⠀⢸⣿⠀⠀⠀⣿⡟⠀⢠⣿⡇⠀⠀⢰⣿⡇⠀⣰⣾⠟⠛⠛⣻⡇⠀⠀⢸⡿⠀⠀⠀⠀⠀⠀⢻⣿⢰⣿⠀⠀⠀⠀⠀⠀⣾⡇⠀⠀⠀⢸⣿⠇⢸⣿⠀⢸⡏",
-      "⣿⣧⣤⣤⣤⡄⠀⠘⣿⣤⣤⡤⣿⠇⠀⢸⣿⠁⠀⠀⣼⣿⠀⠀⢿⣿⣤⣤⠔⣿⠃⠀⠀⣾⡇⠀⠀⠀⠀⠀⠀⢸⣿⣿⠋⠀⠀⠀⢠⣤⣤⣿⣥⣤⡄⠀⣼⣿⠀⣸⡏⠀⣿⠃",
-      "⠉⠉⠉⠉⠉⠁⠀⠀⠈⠉⠉⠀⠉⠀⠀⠈⠉⠀⠀⠀⠉⠉⠀⠀⠀⠉⠉⠁⠈⠉⠀⠀⠀⠉⠀⠀⠀⠀⠀⠀⠀⠈⠉⠉⠀⠀⠀⠀⠈⠉⠉⠉⠉⠉⠁⠀⠉⠁⠀⠉⠁⠀⠉⠀",
-    },
-
-    custom_section = {
-      a = {
-        description = { "  Find File          " },
-        command = "Telescope find_files",
-      },
-      b = {
-        description = { "  New File           " },
-        command = ":ene!",
-      },
-      c = {
-        description = { "  Recent Projects    " },
-        command = "Telescope projects",
-      },
-      d = {
-        description = { "  Recently Used Files" },
-        command = "Telescope oldfiles",
-      },
-      e = {
-        description = { "  Find Word          " },
-        command = "Telescope live_grep",
-      },
-      f = {
-        description = { "  Configuration      " },
-        command = ":e " .. config.user_config_file,
-      },
-    },
-
-    footer = { "lunarvim.org" },
-  }
-  lvim.builtin.which_key.mappings[";"] = { "<cmd>Dashboard<CR>", "Dashboard" }
-end
-
-M.setup = function()
-  vim.g.dashboard_disable_at_vimenter = lvim.builtin.dashboard.disable_at_vim_enter
-
-  vim.g.dashboard_custom_header = lvim.builtin.dashboard.custom_header
-
-  vim.g.dashboard_default_executive = lvim.builtin.dashboard.search_handler
-
-  vim.g.dashboard_custom_section = lvim.builtin.dashboard.custom_section
-
-  vim.g.dashboard_session_directory = lvim.builtin.dashboard.session_directory
-
-  local lvim_site = "lunarvim.org"
-  local lvim_version = require("lvim.utils.git"):get_lvim_version "short"
-  local num_plugins_loaded = #vim.fn.globpath(get_runtime_dir() .. "/site/pack/packer/start", "*", 0, 1)
-
-  local footer = {
-    "LunarVim loaded " .. num_plugins_loaded .. " plugins ",
-    "",
-    lvim_site,
-  }
-
-  if lvim_version then
-    table.insert(footer, 2, "")
-    table.insert(footer, 2, lvim_version)
-  end
-
-  local text = require "lvim.interface.text"
-  vim.g.dashboard_custom_footer = text.align_center({ width = 0 }, footer, 0.49) -- Use 0.49 as  counts for 2 characters
-
-  require("lvim.core.autocmds").define_augroups {
-    _dashboard = {
-      -- seems to be nobuflisted that makes my stuff disappear will do more testing
-      {
-        "FileType",
-        "dashboard",
-        "setlocal nocursorline noswapfile synmaxcol& signcolumn=no norelativenumber nocursorcolumn nospell  nolist  nonumber bufhidden=wipe colorcolumn= foldcolumn=0 matchpairs= ",
-      },
-      {
-        "FileType",
-        "dashboard",
-        "set showtabline=0 | autocmd BufLeave <buffer> set showtabline=" .. vim.opt.showtabline._value,
-      },
-      { "FileType", "dashboard", "nnoremap <silent> <buffer> q :q<CR>" },
-    },
-  }
-
-  if lvim.builtin.dashboard.on_config_done then
-    lvim.builtin.dashboard.on_config_done()
-  end
-end
-
-return M

+ 7 - 1
lua/lvim/core/lualine/init.lua

@@ -34,8 +34,14 @@ M.config = function()
 end
 
 M.setup = function()
+  -- avoid running in headless mode since it's harder to detect failures
+  if #vim.api.nvim_list_uis() == 0 then
+    local Log = require "lvim.core.log"
+    Log:debug "headless mode detected, skipping running setup for lualine"
+    return
+  end
+
   require("lvim.core.lualine.styles").update()
-  require("lvim.core.lualine.utils").validate_theme()
 
   local lualine = require "lualine"
   lualine.setup(lvim.builtin.lualine)

+ 8 - 5
lua/lvim/core/lualine/styles.lua

@@ -10,6 +10,7 @@ local styles = {
 styles.none = {
   style = "none",
   options = {
+    theme = "auto",
     icons_enabled = true,
     component_separators = { left = "", right = "" },
     section_separators = { left = "", right = "" },
@@ -38,6 +39,7 @@ styles.none = {
 styles.default = {
   style = "default",
   options = {
+    theme = "auto",
     icons_enabled = true,
     component_separators = { left = "", right = "" },
     section_separators = { left = "", right = "" },
@@ -66,10 +68,11 @@ styles.default = {
 styles.lvim = {
   style = "lvim",
   options = {
+    theme = "auto",
     icons_enabled = true,
     component_separators = { left = "", right = "" },
     section_separators = { left = "", right = "" },
-    disabled_filetypes = { "dashboard", "NvimTree", "Outline" },
+    disabled_filetypes = { "alpha", "NvimTree", "Outline" },
   },
   sections = {
     lualine_a = {
@@ -113,10 +116,10 @@ function M.get_style(style)
   if not vim.tbl_contains(style_keys, style) then
     local Log = require "lvim.core.log"
     Log:error(
-      "Invalid lualine style",
-      string.format('"%s"', style),
-      "options are: ",
-      string.format('"%s"', table.concat(style_keys, '", "'))
+      "Invalid lualine style"
+        .. string.format('"%s"', style)
+        .. "options are: "
+        .. string.format('"%s"', table.concat(style_keys, '", "'))
     )
     Log:debug '"lvim" style is applied.'
     style = "lvim"

+ 0 - 13
lua/lvim/core/lualine/utils.lua

@@ -1,18 +1,5 @@
 local M = {}
 
-function M.validate_theme()
-  local theme = lvim.builtin.lualine.options.theme or "auto"
-  if type(theme) == "table" then
-    return
-  end
-
-  local lualine_loader = require "lualine.utils.loader"
-  local ok = pcall(lualine_loader.load_theme, theme)
-  if not ok then
-    lvim.builtin.lualine.options.theme = "auto"
-  end
-end
-
 function M.env_cleanup(venv)
   if string.find(venv, "/") then
     local final_venv = venv

+ 1 - 0
lua/lvim/core/which-key.lua

@@ -64,6 +64,7 @@ M.config = function()
       ["/"] = { "<ESC><CMD>lua require('Comment.api').toggle_linewise_op(vim.fn.visualmode())<CR>", "Comment" },
     },
     mappings = {
+      [";"] = { "<cmd>Alpha<CR>", "Dashboard" },
       ["w"] = { "<cmd>w!<CR>", "Save" },
       ["q"] = { "<cmd>q!<CR>", "Quit" },
       ["/"] = { "<cmd>lua require('Comment.api').toggle_current_linewise()<CR>", "Comment" },

+ 9 - 7
lua/lvim/plugins.lua

@@ -1,12 +1,12 @@
 local commit = {
-  bufferline = "f63be9a3a3429a726af14c9085d547281bdf38cc",
+  alpha_nvim = "14be0ac200f44009672046123c6fcb30724018a5",
+  bufferline = "5e101b1b4e1ea5b868b8865a5f749b0b5b8f3ccd",
   cmp_buffer = "d66c4c2d376e5be99db68d2362cd94d250987525",
   cmp_luasnip = "d6f837f4e8fe48eeae288e638691b91b97d1737f",
   cmp_nvim_lsp = "ebdfc204afb87f15ce3d3d3f5df0b8181443b5ba",
   cmp_path = "466b6b8270f7ba89abd59f402c73f63c7331ff6e",
   comment = "a841f73523440c4f32d39f0290cf1e691311db2a",
   dapinstall = "24923c3819a450a772bb8f675926d530e829665f",
-  dashboard_nvim = "d82ddae95fd4dc4c3b7bbe87f09b1840fbf20ecb",
   fixcursorhold = "1bfb32e7ba1344925ad815cb0d7f901dbc0ff7c1",
   friendly_snippets = "ad07b2844021b20797adda5b483265802559a693",
   gitsigns = "2df360de757c39c04076cb04bcbbd361dec3c8c2",
@@ -25,6 +25,7 @@ local commit = {
   nvim_treesitter = "fd92e70c69330dd8f2f6753d3d987c34e7dacd24",
   nvim_ts_context_commentstring = "097df33c9ef5bbd3828105e4bee99965b758dc3f",
   nvim_web_devicons = "4415d1aaa56f73b9c05795af84d625c610b05d3b",
+  onedarker = "b00dd2189f264c5aeb4cf04c59439655ecd573ec",
   packer = "c576ab3f1488ee86d60fd340d01ade08dcabd256",
   plenary = "14dfb4071022b22e08384ee125a5607464b6d397",
   popup = "b7404d35d5d3548a82149238289fa71f7f6de4ac",
@@ -57,6 +58,7 @@ return {
       require("onedarker").setup()
       lvim.builtin.lualine.options.theme = "onedarker"
     end,
+    commit = commit.onedarker,
     disable = lvim.colorscheme ~= "onedarker",
   },
   {
@@ -262,14 +264,14 @@ return {
     disable = not lvim.builtin.dap.active,
   },
 
-  -- Dashboard
+  -- alpha
   {
-    "ChristianChiarulli/dashboard-nvim",
-    event = "BufWinEnter",
+    "goolord/alpha-nvim",
     config = function()
-      require("lvim.core.dashboard").setup()
+      require("lvim.core.alpha").setup()
     end,
-    disable = not lvim.builtin.dashboard.active,
+    commit = commit.alpha_nvim,
+    disable = not lvim.builtin.alpha.active,
   },
 
   -- Terminal

+ 15 - 38
lua/lvim/utils/git.lua

@@ -1,11 +1,12 @@
 local M = {}
 
 local Log = require "lvim.core.log"
+local if_nil = vim.F.if_nil
 
 local function git_cmd(opts)
   local plenary_loaded, Job = pcall(require, "plenary.job")
   if not plenary_loaded then
-    vim.cmd "packadd plenary.nvim"
+    return 1, { "" }
   end
 
   opts = opts or {}
@@ -89,51 +90,27 @@ end
 ---Get the current Lunarvim development branch
 ---@return string|nil
 function M.get_lvim_branch()
-  local ret, branch = git_cmd { args = { "rev-parse", "--abbrev-ref", "HEAD" } }
-  if ret ~= 0 or (not branch or branch[1] == "") then
-    Log:error "Unable to retrieve the name of the current branch. Check the log for further information"
-    return
-  end
-  return branch[1]
+  local _, results = git_cmd { args = { "rev-parse", "--abbrev-ref", "HEAD" } }
+  local branch = if_nil(results[1], "")
+  return branch
 end
 
 ---Get currently checked-out tag of Lunarvim
----@param type string can be "short"
----@return string|nil
-function M.get_lvim_tag(type)
-  type = type or ""
-  local ret, results = git_cmd { args = { "describe", "--tags" } }
-  local lvim_full_ver = results[1] or ""
+---@return string
+function M.get_lvim_tag()
+  local args = { "describe", "--tags", "--abbrev=0" }
 
-  if ret ~= 0 or string.match(lvim_full_ver, "%d") == nil then
-    return nil
-  end
-  if type == "short" then
-    return vim.fn.split(lvim_full_ver, "-")[1]
-  else
-    return string.sub(lvim_full_ver, 1, #lvim_full_ver - 1)
-  end
+  local _, results = git_cmd { args = args }
+  local tag = if_nil(results[1], "")
+  return tag
 end
 
 ---Get the commit hash of currently checked-out commit of Lunarvim
----@param type string can be "short"
 ---@return string|nil
-function M.get_lvim_version(type)
-  type = type or ""
-  local branch = M.get_lvim_branch()
-  if branch == "master" then
-    return M.get_lvim_tag(type)
-  end
-  local ret, log_results = git_cmd { args = { "log", "--pretty=format:%h", "-1" } }
-  local abbrev_version = log_results[1] or ""
-  if ret ~= 0 or string.match(abbrev_version, "%d") == nil then
-    Log:error "Unable to retrieve current version. Check the log for further information"
-    return nil
-  end
-  if type == "short" then
-    return abbrev_version
-  end
-  return branch .. "-" .. abbrev_version
+function M.get_lvim_current_sha()
+  local _, log_results = git_cmd { args = { "log", "--pretty=format:%h", "-1" } }
+  local abbrev_version = if_nil(log_results[1], "")
+  return abbrev_version
 end
 
 function M.generate_plugins_sha(output)

+ 4 - 2
lua/lvim/utils/hooks.lua

@@ -12,8 +12,10 @@ function M.run_pre_reload()
 end
 
 function M.run_on_packer_complete()
-  -- manually trigger event to fix colors
-  vim.cmd [[ doautocmd ColorScheme ]]
+  if not in_headless then
+    -- manually trigger event to fix colors
+    vim.cmd [[ doautocmd ColorScheme ]]
+  end
   Log:info "Reloaded configuration"
 end
 

+ 2 - 1
utils/installer/config.example.lua

@@ -54,7 +54,8 @@ lvim.keys.normal_mode["<C-s>"] = ":w<cr>"
 
 -- TODO: User Config for predefined plugins
 -- After changing plugin config exit and reopen LunarVim, Run :PackerInstall :PackerCompile
-lvim.builtin.dashboard.active = true
+lvim.builtin.alpha.active = true
+lvim.builtin.alpha.mode = "dashboard"
 lvim.builtin.notify.active = true
 lvim.builtin.terminal.active = true
 lvim.builtin.nvimtree.setup.view.side = "left"