fix: try reducing some bugs

This commit is contained in:
JuanZoran
2023-01-10 14:40:28 +08:00
parent 671e3cc7e7
commit 1b95485ae6
8 changed files with 163 additions and 45 deletions

View File

@ -7,7 +7,6 @@ function string:width()
return vim.fn.strdisplaywidth(self)
end
local s_to_b = true -- 从小到大排列
local m_win_width -- 需要被格式化窗口的高度

View File

@ -43,16 +43,21 @@ end
-- curl --data {{'{"name":"bob"}'}} --header {{'Content-Type: application/json'}} {{http://example.com/users/1234}}
local function query_word(q)
local field = (
[[curl -s --header 'Content-Type: application/x-www-form-urlencoded' https://openapi.youdao.com/api]])
for k, v in pairs(q) do
field = field .. ([[ -d '%s=%s']]):format(k, v)
local ok, curl = pcall(require, 'plenary.curl')
if ok then
-- TODO
else
local field = (
[[curl -s --header 'Content-Type: application/x-www-form-urlencoded' https://openapi.youdao.com/api]])
for k, v in pairs(q) do
field = field .. ([[ -d '%s=%s']]):format(k, v)
end
local output = vim.fn.system(field)
local tb = vim.fn.json_decode(output)
return tb
end
-- vim.pretty_print(field)
local output = vim.fn.system(field)
local tb = vim.fn.json_decode(output)
-- print(type(output))
-- vim.pretty_print(tb.basic)
end
M.test = function(query)

View File

@ -5,4 +5,14 @@ local a = {
}
print(a, b)
local function test(tmp)
tmp = {
'bbbbbb'
}
end
test(a)
for i, v in ipairs(a) do
print(v)
end