diff --git a/lua/lualine.lua b/lua/lualine.lua index 94cc78f..9da4650 100644 --- a/lua/lualine.lua +++ b/lua/lualine.lua @@ -179,10 +179,8 @@ local function setup_theme() end local theme = get_theme_from_config() modules.highlight.create_highlight_groups(theme) - vim.cmd [[ - autocmd lualine ColorScheme * lua require'lualine.utils.utils'.reload_highlights() - autocmd lualine OptionSet background lua require'lualine'.setup() - ]] + vim.cmd [[autocmd lualine ColorScheme * lua require'lualine.utils.utils'.reload_highlights() + autocmd lualine OptionSet background lua require'lualine'.setup()]] end local function set_tabline() @@ -201,11 +199,7 @@ local function set_statusline() end local function setup_augroup() - vim.cmd [[ - augroup lualine - autocmd! - augroup END - ]] + vim.cmd [[augroup lualine | autocmd! | augroup END]] end local function reset_lualine() diff --git a/lua/lualine/utils/loader.lua b/lua/lualine/utils/loader.lua index 04cd3df..6220006 100644 --- a/lua/lualine/utils/loader.lua +++ b/lua/lualine/utils/loader.lua @@ -132,12 +132,20 @@ local function load_all(config) load_extensions(config) end +local function rtp_searcher(file) + local ret = {} + for dir in vim.gsplit(vim.api.nvim_get_option('rtp'), ',') do + local path = dir .. sep .. file + if vim.loop.fs_stat(path) then ret[#ret+1] = path end + end + return ret +end + local function load_theme(theme_name) assert(is_valid_filename(theme_name), "Invalid filename") local retval local path = table.concat({'lua', 'lualine', 'themes', theme_name}, sep)..'.lua' - local files = vim.fn.globpath(vim.api.nvim_get_option('rtp'), - path, true, true) + local files = rtp_searcher(path) local n_files = #files if n_files == 0 then -- No match found diff --git a/lua/lualine/utils/section.lua b/lua/lualine/utils/section.lua index ba009d1..ca71544 100644 --- a/lua/lualine/utils/section.lua +++ b/lua/lualine/utils/section.lua @@ -1,6 +1,7 @@ -- Copyright (c) 2020-2021 hoob3rt -- MIT license, see LICENSE for more details. local M = {} +local require = require'lualine_require'.require local utils = require('lualine.utils.utils') local highlight = require('lualine.highlight') -- Returns formated string for a section