Perf: More optimizations
This commit is contained in:
parent
d7304f2b4e
commit
70d925ab17
|
@ -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()
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue