minor improvements to startuptime
This commit is contained in:
parent
59de298d8f
commit
f78dc30508
3 changed files with 31 additions and 26 deletions
3
init.lua
3
init.lua
|
@ -7,7 +7,10 @@ end
|
|||
require "core"
|
||||
require "core.utils"
|
||||
require "core.options"
|
||||
|
||||
vim.defer_fn(function()
|
||||
require("core.utils").load_mappings()
|
||||
end, 0)
|
||||
|
||||
-- setup packer + plugins
|
||||
require("core.packer").bootstrap()
|
||||
|
|
|
@ -74,9 +74,7 @@ M.remove_default_keys = function()
|
|||
end
|
||||
|
||||
M.load_mappings = function(mappings, mapping_opt)
|
||||
mappings = mappings or M.load_config().mappings
|
||||
|
||||
-- set mapping function with/without whichkye
|
||||
-- set mapping function with/without whichkey
|
||||
local map_func
|
||||
local whichkey_exists, wk = pcall(require, "which-key")
|
||||
|
||||
|
@ -92,9 +90,11 @@ M.load_mappings = function(mappings, mapping_opt)
|
|||
end
|
||||
end
|
||||
|
||||
for section, section_mappings in pairs(mappings) do
|
||||
if section ~= "lspconfig" then
|
||||
-- skip mapping this as its mapppings are loaded in lspconfiguti
|
||||
mappings = mappings or vim.deepcopy(M.load_config().mappings)
|
||||
mappings.lspconfig = nil
|
||||
|
||||
for _, section_mappings in pairs(mappings) do
|
||||
-- skip mapping this as its mapppings are loaded in lspconfig
|
||||
for mode, mode_mappings in pairs(section_mappings) do
|
||||
for keybind, mapping_info in pairs(mode_mappings) do
|
||||
-- merge default + user opts
|
||||
|
@ -111,16 +111,12 @@ M.load_mappings = function(mappings, mapping_opt)
|
|||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- load plugin after entering vim ui
|
||||
M.packer_lazy_load = function(plugin, timer)
|
||||
if plugin then
|
||||
timer = timer or 0
|
||||
M.packer_lazy_load = function(plugin)
|
||||
vim.defer_fn(function()
|
||||
require("packer").loader(plugin)
|
||||
end, timer)
|
||||
end
|
||||
end, 0)
|
||||
end
|
||||
|
||||
-- remove plugins defined in chadrc
|
||||
|
|
|
@ -50,7 +50,8 @@ options.icon_styles = {
|
|||
},
|
||||
}
|
||||
|
||||
options.separator_style = options.icon_styles[require("core.utils").load_config().plugins.options.statusline.separator_style]
|
||||
options.separator_style =
|
||||
options.icon_styles[require("core.utils").load_config().plugins.options.statusline.separator_style]
|
||||
|
||||
options.main_icon = {
|
||||
provider = options.separator_style.main_icon,
|
||||
|
@ -126,6 +127,11 @@ options.git_branch = {
|
|||
icon = " ",
|
||||
}
|
||||
|
||||
options.empty_space_git = {
|
||||
provider = " " .. options.separator_style.left,
|
||||
hl = "Feline_EmptySpace_git",
|
||||
}
|
||||
|
||||
-- lsp
|
||||
|
||||
options.diagnostic = {
|
||||
|
@ -255,7 +261,7 @@ options.empty_spaceColored = {
|
|||
hl = function()
|
||||
return {
|
||||
fg = get_color(options.mode_hlgroups[vim.fn.mode()][2], "fg#"),
|
||||
bg = get_color("Feline_EmptySpace", "fg#"),
|
||||
bg = get_color("Feline_EmptySpace", "bg#"),
|
||||
}
|
||||
end,
|
||||
}
|
||||
|
@ -346,8 +352,8 @@ add_table(options.right, options.diff.add)
|
|||
add_table(options.right, options.diff.change)
|
||||
add_table(options.right, options.diff.remove)
|
||||
add_table(options.right, options.git_branch)
|
||||
add_table(options.right, options.empty_space_git)
|
||||
|
||||
add_table(options.right, options.empty_space)
|
||||
add_table(options.right, options.empty_spaceColored)
|
||||
add_table(options.right, options.mode_icon)
|
||||
add_table(options.right, options.mode_name)
|
||||
|
|
Loading…
Reference in a new issue