diff options
Diffstat (limited to 'lua/lvim/core')
-rw-r--r-- | lua/lvim/core/alpha.lua | 62 | ||||
-rw-r--r-- | lua/lvim/core/alpha/dashboard.lua | 83 | ||||
-rw-r--r-- | lua/lvim/core/alpha/startify.lua | 48 | ||||
-rw-r--r-- | lua/lvim/core/autocmds.lua | 13 | ||||
-rw-r--r-- | lua/lvim/core/builtins/init.lua | 2 | ||||
-rw-r--r-- | lua/lvim/core/dashboard.lua | 115 | ||||
-rw-r--r-- | lua/lvim/core/lualine/init.lua | 8 | ||||
-rw-r--r-- | lua/lvim/core/lualine/styles.lua | 13 | ||||
-rw-r--r-- | lua/lvim/core/lualine/utils.lua | 13 | ||||
-rw-r--r-- | lua/lvim/core/which-key.lua | 1 |
10 files changed, 223 insertions, 135 deletions
diff --git a/lua/lvim/core/alpha.lua b/lua/lvim/core/alpha.lua new file mode 100644 index 00000000..67099923 --- /dev/null +++ b/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 diff --git a/lua/lvim/core/alpha/dashboard.lua b/lua/lvim/core/alpha/dashboard.lua new file mode 100644 index 00000000..010d8c1a --- /dev/null +++ b/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 diff --git a/lua/lvim/core/alpha/startify.lua b/lua/lvim/core/alpha/startify.lua new file mode 100644 index 00000000..2ea541f5 --- /dev/null +++ b/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 diff --git a/lua/lvim/core/autocmds.lua b/lua/lvim/core/autocmds.lua index e10a42db..de19d166 100644 --- a/lua/lvim/core/autocmds.lua +++ b/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 diff --git a/lua/lvim/core/builtins/init.lua b/lua/lvim/core/builtins/init.lua index cd47b638..e219d45e 100644 --- a/lua/lvim/core/builtins/init.lua +++ b/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) diff --git a/lua/lvim/core/dashboard.lua b/lua/lvim/core/dashboard.lua deleted file mode 100644 index 438b46f3..00000000 --- a/lua/lvim/core/dashboard.lua +++ /dev/null @@ -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 diff --git a/lua/lvim/core/lualine/init.lua b/lua/lvim/core/lualine/init.lua index c8eca23f..e041e8a8 100644 --- a/lua/lvim/core/lualine/init.lua +++ b/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) diff --git a/lua/lvim/core/lualine/styles.lua b/lua/lvim/core/lualine/styles.lua index f5f5871a..45c6c639 100644 --- a/lua/lvim/core/lualine/styles.lua +++ b/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" diff --git a/lua/lvim/core/lualine/utils.lua b/lua/lvim/core/lualine/utils.lua index d685e044..3fd3c2d3 100644 --- a/lua/lvim/core/lualine/utils.lua +++ b/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 diff --git a/lua/lvim/core/which-key.lua b/lua/lvim/core/which-key.lua index f169a234..511786f0 100644 --- a/lua/lvim/core/which-key.lua +++ b/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" }, |