Closed Andyson007 closed 1 year ago
It seems like the plenary.nvim
was using a wrong curl. Executing the curl -sSL https://documents.devdocs.io/rust/index.json?1690404053
manually was fetching file successfully.
P.S. I am using Windows 11, the default curl is C:\WINDOWS\system32\curl.exe
And how do you fix this?
Only difference being that I'm using packer and not lazy.
It's not related to the package manager or the plugin. The issue is either a problem with plenary or curl itself, the error code 2 refers to an internal error from curl
.
Oh no, the Windows curl doesn't support the --compressed
option. You can execute this code block inside Neovim:
local curl = require("plenary.curl")
vim.print(curl.get("https://devdocs.io/docs.json", {
dry_run = true,
}))
Copy all code and press the :
key, enter this lua <c-r>*<cr>
to execute. The result should be like this:
{ "-sSL", "-D", "C:\\Users\\Username\\AppData\\Local\\Temp\\plenary_curl_a93748a1.headers", "--compressed", "-X", "GET", "https://devdocs.io/docs.json" }
And then you can execute this command curl -sSL --compressed -X GET https://devdocs.io/docs.json
in the terminal (I'm using PowerShell btw), it will complain:
λ curl -sSL --compressed -X GET https://devdocs.io/docs.json
curl: option --compressed: the installed libcurl version doesn't support this
curl: try 'curl --help' for more information
λ echo $LASTEXITCODE
2
So I think the solution is to change your curl path, don't use the Windows default one.
P.S. You can use this code block to check which curl will be used in plenary:
local Job = require'plenary.job'
Job:new({
command = 'where',
args = { 'curl' },
on_exit = function(j, return_val)
vim.print(vim.inspect(return_val))
vim.print(vim.inspect(j:result()))
end,
}):start()
P.P.S. If you're using the scoop
package manager, you can install the curl
by this command: scoop install curl
. And editing your environment variables, keep the <you scoop path>\shims
before the "C:\Windows\System32". After that, everything should be fine.
λ echo $env:SCOOP
<you scoop path>
And how could i replace the curl file used by plenary?
I'm afraid you could not do that easily.
See code below:
local job_opts = {
command = "curl",
args = args,
}
plenary.nvim
doesn't provide an option to specify the curl
path, it just finds that in your path environment variables.
yeah Ok it worked to just add the choco bin path in front of sys32 in the path idk why it didn't work previously
Actually I get this error now. Should i create a new issue for this?
Error executing vim.schedule lua callback: ...acker\start\nvim-devdocs/lua/nvim-devdocs/transpiler.lua:340: attempt to perform arithmetic on local 'col_len' (a nil value) stack traceback: ...acker\start\nvim-devdocs/lua/nvim-devdocs/transpiler.lua:340: in function 'eval_table' ...acker\start\nvim-devdocs/lua/nvim-devdocs/transpiler.lua:225: in function 'eval' ...acker\start\nvim-devdocs/lua/nvim-devdocs/transpiler.lua:388: in function 'fn' ...4\share\nvim\runtime/lua/vim/treesitter/languagetree.lua:341: in function 'for_each_tree' ...acker\start\nvim-devdocs/lua/nvim-devdocs/transpiler.lua:383: in function 'html_to_md' ...ack\packer\start\nvim-devdocs/lua/nvim-devdocs/build.lua:39: in function 'build_docs' ...acker\start\nvim-devdocs/lua/nvim-devdocs/operations.lua:72: in function 'cb' vim/_editor.lua:263: in function <vim/_editor.lua:262>
See this #32
I know that this issue has already been addressed, but without any solutions.