plugins/rest: switch to mkNeovimPlugin

This commit is contained in:
Gaetan Lepage 2024-04-07 14:07:31 +02:00 committed by Gaétan Lepage
parent 3a161eaec0
commit 192b404e41
2 changed files with 365 additions and 184 deletions

View file

@ -7,46 +7,86 @@
plugins.rest = {
enable = true;
resultSplitHorizontal = false;
resultSplitInPlace = false;
stayInCurrentWindowAfterSplit = false;
skipSslVerification = false;
encodeUrl = true;
highlight = {
enabled = true;
timeout = 150;
};
result = {
showUrl = true;
showCurlCommand = true;
showHttpInfo = true;
showHeaders = true;
showStatistics = false;
formatters = {
json = "jq";
html.__raw = ''
function(body)
if vim.fn.executable("tidy") == 0 then
return body
end
-- stylua: ignore
return vim.fn.system({
"tidy", "-i", "-q",
"--tidy-mark", "no",
"--show-body-only", "auto",
"--show-errors", "0",
"--show-warnings", "0",
"-",
}, body):gsub("\n$", "")
end
'';
settings = {
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 = false;
stay_in_current_window_after_split = true;
};
behavior = {
show_info = {
url = true;
headers = true;
http_info = true;
curl_command = true;
};
decode_url = true;
statistics = {
enable = true;
stats = [
{
__unkeyed = "total_time";
title = "Time taken:";
}
{
__unkeyed = "size_download_t";
title = "Download size:";
}
];
};
formatters = {
json = "jq";
html.__raw = ''
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
'';
};
};
};
highlight = {
enable = true;
timeout = 750;
};
keybinds = [
[
"<localleader>rr"
"<cmd>Rest run<cr>"
"Run request under the cursor"
]
[
"<localleader>rl"
"<cmd>Rest run last<cr>"
"Re-run latest request"
]
];
};
jumpToRequest = false;
envFile = ".env";
customDynamicVariables = null;
yankDryRun = true;
searchBack = true;
};
};
}