Breaking change for statusline_separator field users | optimize statusline & make it overridable

added cmd fields for various plugins for example lspinstaller+lspconfig gets loaded only when a file opened but their commands can be run before a file is opened so I additionally lazy loaded them on their cmds too
This commit is contained in:
siduck 2022-06-19 13:43:11 +05:30
parent 099e075a01
commit 4f1ee6ec8f
7 changed files with 78 additions and 77 deletions

View file

@ -22,21 +22,22 @@ M.ui = {
theme_toggle = { "onedark", "one_light" },
theme = "onedark", -- default theme
transparency = false,
statusline = {
separator_style = "default", -- default/round/block/arrow
config = "%!v:lua.require'ui.statusline'.run()",
override = {},
},
}
M.plugins = {
override = {},
remove = {},
user = {},
options = {
lspconfig = {
setup_lspconf = "", -- path of lspconfig file
},
statusline = {
separator_style = "default", -- default/round/block/arrow
config = "%!v:lua.require'ui.statusline'.run()",
},
},
}

View file

@ -69,6 +69,31 @@ M.on_file_open = function(plugin_name)
}
end
-- lspinstaller & lspconfig cmds for lazyloading
M.lsp_cmds = {
"LspInfo",
"LspStart",
"LspRestart",
"LspStop",
"LspInstall",
"LspUnInstall",
"LspUnInstallAll",
"LspInstall",
"LspInstallInfo",
"LspInstallLog",
"LspLog",
"LspPrintInstalled",
}
M.treesitter_cmds = {
"TSInstall",
"TSBufEnable",
"TSBufDisable",
"TSEnable",
"TSDisable",
"TSModuleInhfo",
}
M.gitsigns = function()
-- taken from https://github.com/max397574
vim.api.nvim_create_autocmd({ "BufRead" }, {

View file

@ -1,4 +1,4 @@
-- n, v, i, tare mode names
-- n, v, i, t = mode names
local function termcodes(str)
return vim.api.nvim_replace_termcodes(str, true, true, true)

View file

@ -12,7 +12,7 @@ g.did_load_filetypes = 0
g.do_filetype_lua = 1
opt.laststatus = 3 -- global statusline
opt.statusline = config.plugins.options.statusline.config
opt.statusline = config.ui.statusline.config
opt.showmode = false
opt.title = true