plugins/utils: normalize plugin defaults

This commit is contained in:
Matt Sturgeon 2024-06-11 16:54:57 +01:00
parent b10a391bd0
commit 6ab2a39e6a
No known key found for this signature in database
GPG key ID: 4F91844CED1A8299
53 changed files with 1434 additions and 1221 deletions

View file

@ -287,18 +287,16 @@ helpers.neovim-plugin.mkNeovimPlugin config {
Whether to enable statistics or not.
'';
stats = helpers.defaultNullOpts.mkListOf (with types; attrsOf str) ''
[
{
__unkeyed = "total_time";
title = "Time taken:";
}
{
__unkeyed = "size_download_t";
title = "Download size:";
}
]
'' "See https://curl.se/libcurl/c/curl_easy_getinfo.html.";
stats = helpers.defaultNullOpts.mkListOf (with types; attrsOf str) [
{
__unkeyed = "total_time";
title = "Time taken:";
}
{
__unkeyed = "size_download_t";
title = "Download size:";
}
] "See https://curl.se/libcurl/c/curl_easy_getinfo.html.";
};
formatters = {
@ -306,29 +304,27 @@ helpers.neovim-plugin.mkNeovimPlugin config {
JSON formatter.
'';
html = helpers.defaultNullOpts.mkStr ''
{
__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" }
html = helpers.defaultNullOpts.mkStr {
__raw = ''
function(body)
if vim.fn.executable("tidy") == 0 then
return body, { found = false, name = "tidy" }
end
\'\';
}
'' "HTML formatter.";
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
'';
} "HTML formatter.";
};
};
@ -359,20 +355,18 @@ helpers.neovim-plugin.mkNeovimPlugin config {
keybinds =
helpers.defaultNullOpts.mkListOf (with types; listOf str)
''
[
[
[
"<localleader>rr"
"<cmd>Rest run<cr>"
"Run request under the cursor"
]
[
"<localleader>rl"
"<cmd>Rest run last<cr>"
"Re-run latest request"
]
"<localleader>rr"
"<cmd>Rest run<cr>"
"Run request under the cursor"
]
''
[
"<localleader>rl"
"<cmd>Rest run last<cr>"
"Re-run latest request"
]
]
''
Declare some keybindings.
Format: list of 3 strings lists: key, action and description.