enc: global variable pcode

This commit is contained in:
asep.komarudin 2024-06-14 08:21:36 +07:00
parent ecc54b9f87
commit 65857a4226
45 changed files with 132 additions and 131 deletions

View file

@ -1,4 +1,4 @@
local colorscheme = vim.g.pcode_colorscheme or "gruvbox-baby"
local colorscheme = pcode.colorscheme or "gruvbox-baby"
if substring(tostring(colorscheme), "sonokai") then
colorscheme = "sonokai"

View file

@ -1,5 +1,5 @@
local run = 0
local frmt = vim.g.pcode_format_on_save or 0
local frmt = pcode.format_on_save or 0
if frmt == 1 then
run = 1
else
@ -32,7 +32,7 @@ if run == 1 then
augroup _lsp
autocmd!
" autocmd BufWritePre * lua vim.lsp.buf.format{timeout_ms =200, filter=format_filter}
autocmd BufWritePre * lua vim.lsp.buf.format{timeout_ms=vim.g.pcode_format_timeout_ms or 5000 ,filter=FORMAT_FILTER}
autocmd BufWritePre * lua vim.lsp.buf.format{timeout_ms=pcode.format_timeout_ms or 5000 ,filter=FORMAT_FILTER}
augroup end
]]
end

View file

@ -8,7 +8,7 @@ local lspconfig = require("lspconfig")
-- local servers = { "jsonls", "sumneko_lua","html","cssls","tsserver"}
-- local servers = { "jdtls", "yamlls" }
local servers = {}
local installer = vim.g.pcode_lsp_installer or {}
local installer = pcode.lsp_installer or {}
for _, client in pairs(installer) do
table.insert(servers, client)
end

View file

@ -5,7 +5,7 @@ if not status_cmp_ok then
return
end
local lspvitualtext = vim.g.pcode_lsp_virtualtext or false
local lspvitualtext = pcode.lsp_virtualtext or false
local icons = vim.g.pcode_icons
M.capabilities = vim.lsp.protocol.make_client_capabilities()

View file

@ -11,12 +11,12 @@ local function idxOf(array, value)
return nil
end
local mason_install = vim.g.pcode_mason_ensure_installed or {}
local mason_install = pcode.mason_ensure_installed or {}
for _, client in pairs(mason_install) do
table.insert(servers, client)
end
local unregis_lsp = vim.g.pcode_unregister_lsp or {}
local unregis_lsp = pcode.unregister_lsp or {}
local icons = vim.g.pcode_icons.ui
local settings = {

View file

@ -21,7 +21,7 @@ if data_ok then
end
-- load data null-ls
local nullls_data = vim.g.pcode_null_ls_ensure_installed or {}
local nullls_data = pcode.null_ls_ensure_installed or {}
for _, nullls in pairs(nullls_data) do
table.insert(ensure_installed, nullls)
end
@ -34,7 +34,7 @@ if mason_ok then
end
local run = 0
local frmt = vim.g.pcode_format_on_save or 0
local frmt = pcode.format_on_save or 0
if frmt == 1 then
run = 1
end

View file

@ -1,5 +1,5 @@
local sources = {}
local dap_data = vim.g.pcode_dap_ensure_installed or {}
local dap_data = pcode.dap_ensure_installed or {}
for _, nullls in pairs(dap_data) do
table.insert(sources, nullls)
end

View file

@ -5,7 +5,7 @@ end
local transp = false
local sidebar = "normal" --"dark , transparent, normal"
local hilight = "#292e42"
local tras = vim.g.pcode_transparent_mode or 0
local tras = pcode.transparent_mode or 0
if tras == 1 then
transp = true
sidebar = "transparent"

View file

@ -53,7 +53,7 @@ return {
codeium = {
function()
if vim.g.pcode_codeium then
if pcode.codeium then
local codeium = all_trim(vim.api.nvim_call_function("codeium#GetStatusString", {}))
if codeium then
if codeium == "OFF" then
@ -69,7 +69,7 @@ return {
end
end,
color = function()
if vim.g.pcode_codeium then
if pcode.codeium then
local codeium = all_trim(vim.api.nvim_call_function("codeium#GetStatusString", {}))
return { fg = codeium == "OFF" and "#3E4452" or "#50fa7b" }
else
@ -164,13 +164,13 @@ return {
padding = 1,
separator = { left = "" },
fmt = function(str)
if vim.g.pcode_show_mode == 1 then
if pcode.show_mode == 1 then
return icons.ui.Neovim .. " " .. (mode_map[str] or str)
elseif vim.g.pcode_show_mode == 2 then
elseif pcode.show_mode == 2 then
return icons.ui.Neovim
elseif vim.g.pcode_show_mode == 3 then
elseif pcode.show_mode == 3 then
return (mode_map[str] or str)
elseif vim.g.pcode_show_mode == 4 then
elseif pcode.show_mode == 4 then
return nil
else
return icons.ui.Neovim .. " " .. str
@ -182,13 +182,13 @@ return {
padding = 1,
separator = { left = "", right = "" },
fmt = function(str)
if vim.g.pcode_show_mode == 1 then
if pcode.show_mode == 1 then
return icons.ui.Neovim .. " " .. (mode_map[str] or str)
elseif vim.g.pcode_show_mode == 2 then
elseif pcode.show_mode == 2 then
return icons.ui.Neovim
elseif vim.g.pcode_show_mode == 3 then
elseif pcode.show_mode == 3 then
return (mode_map[str] or str)
elseif vim.g.pcode_show_mode == 4 then
elseif pcode.show_mode == 4 then
return nil
else
return icons.ui.Neovim .. " " .. str
@ -200,13 +200,13 @@ return {
padding = 1,
separator = { left = " ", right = "" },
fmt = function(str)
if vim.g.pcode_show_mode == 1 then
if pcode.show_mode == 1 then
return icons.ui.Neovim .. " " .. (mode_map[str] or str)
elseif vim.g.pcode_show_mode == 2 then
elseif pcode.show_mode == 2 then
return icons.ui.Neovim
elseif vim.g.pcode_show_mode == 3 then
elseif pcode.show_mode == 3 then
return (mode_map[str] or str)
elseif vim.g.pcode_show_mode == 4 then
elseif pcode.show_mode == 4 then
return nil
else
return icons.ui.Neovim .. " " .. str
@ -218,13 +218,13 @@ return {
padding = 1,
separator = { left = "", right = "" },
fmt = function(str)
if vim.g.pcode_show_mode == 1 then
if pcode.show_mode == 1 then
return icons.ui.Neovim .. " " .. (mode_map[str] or str)
elseif vim.g.pcode_show_mode == 2 then
elseif pcode.show_mode == 2 then
return icons.ui.Neovim
elseif vim.g.pcode_show_mode == 3 then
elseif pcode.show_mode == 3 then
return (mode_map[str] or str)
elseif vim.g.pcode_show_mode == 4 then
elseif pcode.show_mode == 4 then
return nil
else
return icons.ui.Neovim .. " " .. str
@ -237,13 +237,13 @@ return {
padding = 1,
separator = { left = " " },
fmt = function(str)
if vim.g.pcode_show_mode == 1 then
if pcode.show_mode == 1 then
return icons.ui.Neovim .. " " .. (mode_map[str] or str)
elseif vim.g.pcode_show_mode == 2 then
elseif pcode.show_mode == 2 then
return icons.ui.Neovim
elseif vim.g.pcode_show_mode == 3 then
elseif pcode.show_mode == 3 then
return (mode_map[str] or str)
elseif vim.g.pcode_show_mode == 4 then
elseif pcode.show_mode == 4 then
return nil
else
return icons.ui.Neovim .. " " .. str

View file

@ -278,11 +278,11 @@ M.mappings = {
},
}
if vim.g.pcode_codeium then
if pcode.codeium then
table.insert(M.mappings, { ["c"] = { ":call codeium#Chat()<cr>", "󰭹 Codeium Chat" } })
end
if vim.g.pcode_database then
if pcode.database then
table.insert(M.mappings, {
["D"] = {
name = " 󰆼 DBUI",