rest.nvim
rest.nvim copied to clipboard
v3 migration issue
My configuration for rest-nvim has been unchanged for months but after updating to the latest version it breaks my configuration and I get the following error.
Failed to run `config` for rest.nvim
.../.local/share/nvim/lazy/rest.nvim/lua/rest-nvim/init.lua:19: Couldn't convert lua value
# stacktrace:
- /rest.nvim/lua/rest-nvim/init.lua:19 _in_ **setup**
- ~/.config/nvim/lua/plugins/rest.lua:70 _in_ **config**
- /usr/share/nvim/runtime/filetype.lua:36
- vim/shared.lua:0
- /usr/share/nvim/runtime/filetype.lua:35
- vim/_editor.lua:0 _in_ **cmd**
- /persisted.nvim/lua/persisted/init.lua:69 _in_ **load**
- /persisted.nvim/lua/persisted/init.lua:43
Configuration is below, looking at the readme it seems the way to configure rest-nvim may have changed, although I'm not sure how to convert what I have to the new method as it doesn't seem to have the same options. I'm also not familiar with using vim.g to configure a module. Is the old method of configuration no longer supported?
{
"rest-nvim/rest.nvim",
ft = "http",
dependencies = { "luarocks.nvim" },
config = function()
require("rest-nvim").setup({
client = "curl",
env_file = ".env",
env_pattern = "\\.env$",
env_edit_command = "tabedit",
encode_url = true,
skip_ssl_verification = false,
custom_dynamic_variables = {},
logs = {
level = "info",
save = true,
},
result = {
split = {
horizontal = false,
in_place = true,
stay_in_current_window_after_split = true,
},
behavior = {
decode_url = true,
show_info = {
url = true,
headers = true,
http_info = true,
curl_command = true,
},
statistics = {
enable = true,
---@see https://curl.se/libcurl/c/curl_easy_getinfo.html
stats = {
{ "total_time", title = "Time taken:" },
{ "size_download_t", title = "Download size:" },
},
},
formatters = {
json = "jq",
html = function(body)
if vim.fn.executable("tidy") == 0 then
return body, { found = false, name = "tidy" }
end
local fmt_body = vim.fn
.system({
"tidy",
"-i",
"-q",
"--tidy-mark",
"no",
"--show-body-only",
"auto",
"--show-errors",
"0",
"--show-warnings",
"0",
"-",
}, body)
:gsub("\n$", "")
return fmt_body, { found = true, name = "tidy" }
end,
},
},
keybinds = {
buffer_local = true,
prev = "P",
next = "N",
},
},
highlight = {
enable = true,
timeout = 750,
},
})
vim.keymap.set("n", "<leader>rr", "<cmd>Rest run<CR>", { desc = "Run rest command" })
vim.keymap.set("n", "<leader>rl", "<cmd>Rest run last<CR>", { desc = "Run last rest command" })
end,
},