refactor: try to remove dependency for plenary.curl

This commit is contained in:
JuanZoran
2023-03-10 11:23:22 +08:00
parent a5164bf052
commit 8dd538ba60
7 changed files with 136 additions and 43 deletions

View File

@@ -3,22 +3,10 @@ return function(opts)
if opts then
M.conf = vim.tbl_deep_extend('force', M.conf, opts)
end
local conf = M.conf
local set_hl = vim.api.nvim_set_hl
local hls = require('Trans.style.theme')[conf.theme]
local hls = require('Trans.style.theme')[M.conf.theme]
for hl, opt in pairs(hls) do
set_hl(0, hl, opt)
end
local path = vim.fn.expand("$HOME/.vim/dict/Trans.json")
local file = io.open(path, "r")
if file then
local content = file:read("*a")
file:close()
local status, engine = pcall(vim.json.decode, content)
assert(status, 'Unable to parse json file: ' .. path)
conf.engine = engine
end
end