Perf: More optimizations
This commit is contained in:
parent
d7304f2b4e
commit
70d925ab17
|
@ -179,10 +179,8 @@ local function setup_theme()
|
||||||
end
|
end
|
||||||
local theme = get_theme_from_config()
|
local theme = get_theme_from_config()
|
||||||
modules.highlight.create_highlight_groups(theme)
|
modules.highlight.create_highlight_groups(theme)
|
||||||
vim.cmd [[
|
vim.cmd [[autocmd lualine ColorScheme * lua require'lualine.utils.utils'.reload_highlights()
|
||||||
autocmd lualine ColorScheme * lua require'lualine.utils.utils'.reload_highlights()
|
autocmd lualine OptionSet background lua require'lualine'.setup()]]
|
||||||
autocmd lualine OptionSet background lua require'lualine'.setup()
|
|
||||||
]]
|
|
||||||
end
|
end
|
||||||
|
|
||||||
local function set_tabline()
|
local function set_tabline()
|
||||||
|
@ -201,11 +199,7 @@ local function set_statusline()
|
||||||
end
|
end
|
||||||
|
|
||||||
local function setup_augroup()
|
local function setup_augroup()
|
||||||
vim.cmd [[
|
vim.cmd [[augroup lualine | autocmd! | augroup END]]
|
||||||
augroup lualine
|
|
||||||
autocmd!
|
|
||||||
augroup END
|
|
||||||
]]
|
|
||||||
end
|
end
|
||||||
|
|
||||||
local function reset_lualine()
|
local function reset_lualine()
|
||||||
|
|
|
@ -132,12 +132,20 @@ local function load_all(config)
|
||||||
load_extensions(config)
|
load_extensions(config)
|
||||||
end
|
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)
|
local function load_theme(theme_name)
|
||||||
assert(is_valid_filename(theme_name), "Invalid filename")
|
assert(is_valid_filename(theme_name), "Invalid filename")
|
||||||
local retval
|
local retval
|
||||||
local path = table.concat({'lua', 'lualine', 'themes', theme_name}, sep)..'.lua'
|
local path = table.concat({'lua', 'lualine', 'themes', theme_name}, sep)..'.lua'
|
||||||
local files = vim.fn.globpath(vim.api.nvim_get_option('rtp'),
|
local files = rtp_searcher(path)
|
||||||
path, true, true)
|
|
||||||
local n_files = #files
|
local n_files = #files
|
||||||
if n_files == 0 then
|
if n_files == 0 then
|
||||||
-- No match found
|
-- No match found
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
-- Copyright (c) 2020-2021 hoob3rt
|
-- Copyright (c) 2020-2021 hoob3rt
|
||||||
-- MIT license, see LICENSE for more details.
|
-- MIT license, see LICENSE for more details.
|
||||||
local M = {}
|
local M = {}
|
||||||
|
local require = require'lualine_require'.require
|
||||||
local utils = require('lualine.utils.utils')
|
local utils = require('lualine.utils.utils')
|
||||||
local highlight = require('lualine.highlight')
|
local highlight = require('lualine.highlight')
|
||||||
-- Returns formated string for a section
|
-- Returns formated string for a section
|
||||||
|
|
Loading…
Reference in New Issue