mirror of
https://github.com/pojokcodeid/nvim-lazy.git
synced 2025-06-29 20:14:28 +02:00
migrate config form function to global variable
This commit is contained in:
parent
b6f0601d3d
commit
38d2c29a95
24 changed files with 248 additions and 245 deletions
|
@ -1,16 +1,14 @@
|
|||
local data_exists, custom_dasboard = pcall(require, "custom.dashboard")
|
||||
local data_exists, custom_dasboard = pcall(require, "core.config")
|
||||
if data_exists then
|
||||
if type(custom_dasboard) == "table" then
|
||||
local model = custom_dasboard.model
|
||||
if model ~= nil then
|
||||
if model == 1 then
|
||||
require("user.startify")
|
||||
else
|
||||
require("user.dashboard")
|
||||
end
|
||||
else
|
||||
local model = custom_dasboard.model
|
||||
if model ~= nil then
|
||||
if model == 1 then
|
||||
require("user.startify")
|
||||
else
|
||||
require("user.dashboard")
|
||||
end
|
||||
else
|
||||
require("user.startify")
|
||||
end
|
||||
else
|
||||
require("user.startify")
|
||||
|
|
|
@ -4,21 +4,18 @@ local lst_style =
|
|||
local lst_material = { "material", "material_deepocean", "material_palenight", "material_lighter", "material_darker" }
|
||||
local lst_onedark =
|
||||
{ "onedark", "onedark_darker", "onedark_cool", "onedark_deep,onedark_warm", "onedark_warmer", "onedark_light" }
|
||||
local data_exists, custom_ui = pcall(require, "custom.ui")
|
||||
local data_exists, config = pcall(require, "core.config")
|
||||
if data_exists then
|
||||
if type(custom_ui) == "table" then
|
||||
local color = custom_ui.colorscheme
|
||||
if color ~= nil then
|
||||
colorscheme = color
|
||||
else
|
||||
colorscheme = "gruvbox-baby"
|
||||
end
|
||||
local transparent_mode = custom_ui.transparent_mode
|
||||
if transparent_mode ~= nil then
|
||||
if transparent_mode == 1 then
|
||||
vim.g.gruvbox_baby_transparent_mode = 1
|
||||
vim.g.sonokai_transparent_background = 2
|
||||
end
|
||||
if config.colorscheme ~= nil then
|
||||
colorscheme = config.colorscheme
|
||||
else
|
||||
colorscheme = "gruvbox-baby"
|
||||
end
|
||||
local transparent_mode = config.transparent_mode
|
||||
if transparent_mode ~= nil then
|
||||
if transparent_mode == 1 then
|
||||
vim.g.gruvbox_baby_transparent_mode = 1
|
||||
vim.g.sonokai_transparent_background = 2
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -14,13 +14,11 @@ local board = {
|
|||
[[|_| |__/ ]],
|
||||
}
|
||||
|
||||
local data_exists, custom_dasboard = pcall(require, "custom.dashboard")
|
||||
local data_exists, custom_dasboard = pcall(require, "core.config")
|
||||
if data_exists then
|
||||
if type(custom_dasboard) == "table" then
|
||||
local data_board = custom_dasboard.dashboard2
|
||||
if data_board ~= nil then
|
||||
board = data_board
|
||||
end
|
||||
local data_board = custom_dasboard.dashboard2
|
||||
if data_board ~= nil then
|
||||
board = data_board
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -40,11 +38,9 @@ dashboard.section.buttons.val = {
|
|||
local function footer()
|
||||
local footer_text = "Pojok Code"
|
||||
if data_exists then
|
||||
if type(custom_dasboard) == "table" then
|
||||
local data_txt = custom_dasboard.footer
|
||||
if data_txt ~= nil then
|
||||
footer_text = data_txt
|
||||
end
|
||||
local data_txt = custom_dasboard.footer
|
||||
if data_txt ~= nil then
|
||||
footer_text = data_txt
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
local run = 0
|
||||
local data_exists, frmt = pcall(require, "custom.format_onsave")
|
||||
local data_exists, frmt = pcall(require, "core.config")
|
||||
if not data_exists then
|
||||
run = 1
|
||||
end
|
||||
if frmt.disable == 0 then
|
||||
if frmt.format_on_save == 1 then
|
||||
run = 1
|
||||
end
|
||||
|
||||
|
|
|
@ -9,14 +9,13 @@ local lspconfig = require("lspconfig")
|
|||
-- local servers = { "jdtls", "yamlls" }
|
||||
local servers = {}
|
||||
|
||||
local data_exists, custom_lsp = pcall(require, "custom.lsp_installer")
|
||||
local data_exists, custom_lsp = pcall(require, "core.config")
|
||||
if data_exists then
|
||||
for _, client in pairs(custom_lsp.lspinstall) do
|
||||
for _, client in pairs(custom_lsp.lsp_installer) do
|
||||
table.insert(servers, client)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
lsp_installer.setup({
|
||||
ensure_installed = servers,
|
||||
})
|
||||
|
|
|
@ -17,17 +17,17 @@ local function idxOf(array, value)
|
|||
return nil
|
||||
end
|
||||
|
||||
local data_exists, custom_lsp = pcall(require, "custom.register_lsp")
|
||||
local data_exists, custom_lsp = pcall(require, "core.config")
|
||||
if data_exists then
|
||||
for _, client in pairs(custom_lsp.lspreg) do
|
||||
for _, client in pairs(custom_lsp.register_lsp) do
|
||||
table.insert(servers, client)
|
||||
end
|
||||
end
|
||||
|
||||
local data_ok, unregis = pcall(require, "custom.register_lsp")
|
||||
local data_ok, unregis = pcall(require, "core.config")
|
||||
if data_ok then
|
||||
if unregis.skip_reg ~= nil then
|
||||
for _, unreg in pairs(custom_lsp.skip_reg) do
|
||||
if unregis.unregister_lsp ~= nil then
|
||||
for _, unreg in pairs(custom_lsp.unregister_lsp) do
|
||||
local my_index = idxOf(servers, unreg)
|
||||
table.remove(servers, my_index)
|
||||
end
|
||||
|
|
|
@ -12,19 +12,19 @@ local augroup = vim.api.nvim_create_augroup("LspFormatting", {})
|
|||
|
||||
local sources = {}
|
||||
|
||||
local data_exists, data = pcall(require, "custom.null-ls")
|
||||
local data_exists, data = pcall(require, "core.config")
|
||||
if data_exists then
|
||||
for _, cfg in pairs(data.sources) do
|
||||
for _, cfg in pairs(data.null_ls_sources) do
|
||||
table.insert(sources, cfg)
|
||||
end
|
||||
end
|
||||
|
||||
local run = 0
|
||||
local data_exists, frmt = pcall(require, "custom.format_onsave")
|
||||
if not data_exists then
|
||||
local ok, frmt = pcall(require, "core.config")
|
||||
if not ok then
|
||||
run = 1
|
||||
end
|
||||
if frmt.disable == 0 then
|
||||
if frmt.format_on_save == 1 then
|
||||
run = 1
|
||||
end
|
||||
|
||||
|
|
|
@ -53,40 +53,38 @@ local section_separators = { left = "", right = "" }
|
|||
local icon_mode = ""
|
||||
local sts_mode = 0
|
||||
|
||||
local data_exists, custom_ui = pcall(require, "custom.ui")
|
||||
local data_exists, custom_ui = pcall(require, "core.config")
|
||||
if data_exists then
|
||||
if type(custom_ui) == "table" then
|
||||
local ui_style = custom_ui.lualine_style
|
||||
if ui_style ~= nil then
|
||||
if custom_ui.lualine_style == 1 then
|
||||
component_separators = { left = "", right = "" }
|
||||
section_separators = { left = "", right = "" }
|
||||
elseif custom_ui.lualine_style == 2 then
|
||||
component_separators = { left = "", right = "" }
|
||||
section_separators = { left = " ", right = " " }
|
||||
elseif custom_ui.lualine_style == 3 then
|
||||
component_separators = { left = "", right = "" }
|
||||
section_separators = { left = "", right = "" }
|
||||
end
|
||||
local ui_style = custom_ui.lualine_style
|
||||
if ui_style ~= nil then
|
||||
if custom_ui.lualine_style == 1 then
|
||||
component_separators = { left = "", right = "" }
|
||||
section_separators = { left = "", right = "" }
|
||||
elseif custom_ui.lualine_style == 2 then
|
||||
component_separators = { left = "", right = "" }
|
||||
section_separators = { left = " ", right = " " }
|
||||
elseif custom_ui.lualine_style == 3 then
|
||||
component_separators = { left = "", right = "" }
|
||||
section_separators = { left = "", right = "" }
|
||||
end
|
||||
local ui_icon = custom_ui.status_icon
|
||||
if ui_icon ~= nil then
|
||||
if custom_ui.status_icon == 1 then
|
||||
icon_mode = " "
|
||||
sts_mode = 1
|
||||
elseif custom_ui.status_icon == 2 then
|
||||
icon_mode = " "
|
||||
sts_mode = 1
|
||||
end
|
||||
end
|
||||
local ui_icon = custom_ui.status_icon
|
||||
if ui_icon ~= nil then
|
||||
if custom_ui.status_icon == 1 then
|
||||
icon_mode = " "
|
||||
sts_mode = 1
|
||||
elseif custom_ui.status_icon == 2 then
|
||||
icon_mode = " "
|
||||
sts_mode = 1
|
||||
end
|
||||
local custom_style = custom_ui.custom_lualine
|
||||
if custom_style ~= nil and custom_style == true then
|
||||
local comp = custom_ui.component_separators
|
||||
local section = custom_ui.section_separators
|
||||
if comp ~= nil and section ~= nil then
|
||||
component_separators = comp
|
||||
section_separators = section
|
||||
end
|
||||
end
|
||||
local custom_style = custom_ui.custom_lualine
|
||||
if custom_style ~= nil and custom_style == true then
|
||||
local comp = custom_ui.component_separators
|
||||
local section = custom_ui.section_separators
|
||||
if comp ~= nil and section ~= nil then
|
||||
component_separators = comp
|
||||
section_separators = section
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -9,13 +9,11 @@ dash_model = {
|
|||
[[ /_/ |___/ ]],
|
||||
}
|
||||
|
||||
local data_exists, custom_dasboard = pcall(require, "custom.dashboard")
|
||||
local data_exists, custom_dasboard = pcall(require, "core.config")
|
||||
if data_exists then
|
||||
if type(custom_dasboard) == "table" then
|
||||
local board = custom_dasboard.dashboard1
|
||||
if board ~= nil then
|
||||
dash_model = board
|
||||
end
|
||||
local board = custom_dasboard.dashboard1
|
||||
if board ~= nil then
|
||||
dash_model = board
|
||||
end
|
||||
end
|
||||
startify.section.header.val = dash_model
|
||||
|
@ -44,11 +42,9 @@ startify.section.bottom_buttons.val = {
|
|||
|
||||
local footer_text = "Pojok Code"
|
||||
if data_exists then
|
||||
if type(custom_dasboard) == "table" then
|
||||
local data_txt = custom_dasboard.footer
|
||||
if data_txt ~= nil then
|
||||
footer_text = data_txt
|
||||
end
|
||||
local data_txt = custom_dasboard.footer
|
||||
if data_txt ~= nil then
|
||||
footer_text = data_txt
|
||||
end
|
||||
end
|
||||
startify.section.footer.val = {
|
||||
|
|
|
@ -4,14 +4,12 @@ if not status_ok then
|
|||
end
|
||||
local transp = false
|
||||
local sidebar = "dark"
|
||||
local data_exists, custom_ui = pcall(require, "custom.ui")
|
||||
local data_exists, config = pcall(require, "core.config")
|
||||
if data_exists then
|
||||
if type(custom_ui) == "table" then
|
||||
local tras = custom_ui.transparent_mode
|
||||
if tras ~= nil and tras == 1 then
|
||||
transp = true
|
||||
sidebar = "transparent"
|
||||
end
|
||||
local tras = config.transparent_mode
|
||||
if tras == 1 then
|
||||
transp = true
|
||||
sidebar = "transparent"
|
||||
end
|
||||
end
|
||||
tokyonight.setup({
|
||||
|
|
|
@ -395,11 +395,9 @@ local mappings = {
|
|||
}
|
||||
|
||||
local wkey = {}
|
||||
local data_exists, key = pcall(require, "custom.whichkey")
|
||||
local data_exists, key = pcall(require, "core.config")
|
||||
if data_exists then
|
||||
if type(key) == "table" then
|
||||
wkey = key
|
||||
end
|
||||
wkey = key.whichkey
|
||||
end
|
||||
|
||||
which_key.setup(setup)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue