diff options
author | kylo252 <[email protected]> | 2022-03-24 15:48:33 +0100 |
---|---|---|
committer | kylo252 <[email protected]> | 2022-03-24 15:48:33 +0100 |
commit | f41edc6dfb0d2a4c9875da08bbbdab121e52048f (patch) | |
tree | c6541278c6314e58d991bc95e547e903ac58340a /lua/lvim/core/lualine | |
parent | 5ee460fdc751a91cdf7a4f4aab2ab784ebdb36fd (diff) | |
parent | 1ea836e3601b7ed0ed0496888dc14683bfbcce75 (diff) |
Merge remote-tracking branch 'origin/rolling'1.1.3
Diffstat (limited to 'lua/lvim/core/lualine')
-rw-r--r-- | lua/lvim/core/lualine/init.lua | 9 | ||||
-rw-r--r-- | lua/lvim/core/lualine/styles.lua | 16 | ||||
-rw-r--r-- | lua/lvim/core/lualine/utils.lua | 13 |
3 files changed, 16 insertions, 22 deletions
diff --git a/lua/lvim/core/lualine/init.lua b/lua/lvim/core/lualine/init.lua index c5d024c2..e041e8a8 100644 --- a/lua/lvim/core/lualine/init.lua +++ b/lua/lvim/core/lualine/init.lua @@ -9,6 +9,7 @@ M.config = function() section_separators = nil, theme = nil, disabled_filetypes = nil, + globalstatus = false, }, sections = { lualine_a = nil, @@ -33,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 0843aead..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" @@ -127,9 +130,6 @@ end function M.update() local style = M.get_style(lvim.builtin.lualine.style) - if lvim.builtin.lualine.options.theme == nil then - lvim.builtin.lualine.options.theme = lvim.colorscheme - end lvim.builtin.lualine = vim.tbl_deep_extend("keep", lvim.builtin.lualine, style) end diff --git a/lua/lvim/core/lualine/utils.lua b/lua/lvim/core/lualine/utils.lua index cf80a99e..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 - 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 |