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