enc: upgrade v2 to v2.5

This commit is contained in:
Pojok Code 2024-11-04 21:29:25 +07:00
parent 68ea712b98
commit 609234c086
443 changed files with 5224 additions and 90746 deletions

View file

@ -0,0 +1,55 @@
_G.idxOf = function(array, value)
for i, v in ipairs(array) do
if v == value then
return i
end
end
return nil
end
_G.LAZYGIT_TOGGLE = function()
local ok = pcall(require, "toggleterm")
if not ok then
require("notify")("toggleterm not found!", "error")
return
end
local Terminal = require("toggleterm.terminal").Terminal
local lazygit = Terminal:new({ cmd = "lazygit", hidden = true })
lazygit:toggle()
end
_G.substring = function(text, key)
local index, _ = string.find(text, key)
if index then
return true
else
return false
end
end
_G.all_trim = function(s)
return s:match("^%s*(.-)%s*$")
end
_G.current_theme = function()
if pcode.themes then
local theme = ""
for _, value in pairs(pcode.themes or {}) do
theme = value
end
return all_trim(theme)
end
return ""
end
local function safeRequire(module)
local ok, result = pcall(require, module)
if ok then
return result
end
end
safeRequire("pcode.user.options")
safeRequire("pcode.user.autocmd")
safeRequire("pcode.user.keymaps")
return {}