mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-21 08:35:43 +02:00
plugins/rest: add dependencies
https://github.com/rest-nvim/rest.nvim?tab=readme-ov-file#dependencies
This commit is contained in:
parent
6c9d178ecc
commit
b7dea12375
2 changed files with 103 additions and 94 deletions
|
@ -1,4 +1,5 @@
|
||||||
{
|
{
|
||||||
|
config,
|
||||||
lib,
|
lib,
|
||||||
helpers,
|
helpers,
|
||||||
pkgs,
|
pkgs,
|
||||||
|
@ -401,21 +402,33 @@ helpers.neovim-plugin.mkNeovimPlugin {
|
||||||
};
|
};
|
||||||
|
|
||||||
extraOptions = {
|
extraOptions = {
|
||||||
|
curlPackage = lib.mkPackageOption pkgs "curl" {
|
||||||
|
nullable = true;
|
||||||
|
};
|
||||||
|
|
||||||
enableHttpFiletypeAssociation = lib.mkOption {
|
enableHttpFiletypeAssociation = lib.mkOption {
|
||||||
type = types.bool;
|
type = types.bool;
|
||||||
default = true;
|
default = true;
|
||||||
description = ''
|
description = ''
|
||||||
Sets up the filetype association of `.http` files to trigger treesitter support.
|
Sets up the filetype association of `.http` files to trigger treesitter support to enable `rest` functionality.
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
extraConfig = cfg: {
|
extraConfig = cfg: {
|
||||||
|
assertions = [
|
||||||
|
{
|
||||||
|
assertion = config.plugins.treesitter.enable;
|
||||||
|
message = ''
|
||||||
|
Nixvim (plugins.rest): Requires the `http` parser from `plugins.treesitter`, please set `plugins.treesitter.enable`.
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
extraPackages = [ cfg.curlPackage ];
|
||||||
|
|
||||||
filetype = lib.mkIf cfg.enableHttpFiletypeAssociation {
|
filetype = lib.mkIf cfg.enableHttpFiletypeAssociation {
|
||||||
extension = {
|
extension.http = "http";
|
||||||
"http" = "http";
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,106 +1,102 @@
|
||||||
{
|
{
|
||||||
empty = {
|
empty = {
|
||||||
# As of 2024-05-07, the lua dependencies of luaPackage.rest-nvim are not correctly propagated to
|
plugins = {
|
||||||
# the vim plugin.
|
rest.enable = true;
|
||||||
# TODO: re-enable this test when this issue will have been fixed
|
treesitter.enable = true;
|
||||||
test.runNvim = false;
|
};
|
||||||
|
|
||||||
plugins.rest.enable = true;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
defaults = {
|
defaults = {
|
||||||
# As of 2024-05-07, the lua dependencies of luaPackage.rest-nvim are not correctly propagated to
|
plugins = {
|
||||||
# the vim plugin.
|
treesitter.enable = true;
|
||||||
# TODO: re-enable this test when this issue will have been fixed
|
rest = {
|
||||||
test.runNvim = false;
|
enable = true;
|
||||||
|
|
||||||
plugins.rest = {
|
settings = {
|
||||||
enable = true;
|
client = "curl";
|
||||||
|
env_file = ".env";
|
||||||
settings = {
|
env_pattern = "\\.env$";
|
||||||
client = "curl";
|
env_edit_command = "tabedit";
|
||||||
env_file = ".env";
|
encode_url = true;
|
||||||
env_pattern = "\\.env$";
|
skip_ssl_verification = false;
|
||||||
env_edit_command = "tabedit";
|
custom_dynamic_variables = { };
|
||||||
encode_url = true;
|
logs = {
|
||||||
skip_ssl_verification = false;
|
level = "info";
|
||||||
custom_dynamic_variables = { };
|
save = true;
|
||||||
logs = {
|
|
||||||
level = "info";
|
|
||||||
save = true;
|
|
||||||
};
|
|
||||||
result = {
|
|
||||||
split = {
|
|
||||||
horizontal = false;
|
|
||||||
in_place = false;
|
|
||||||
stay_in_current_window_after_split = true;
|
|
||||||
};
|
};
|
||||||
behavior = {
|
result = {
|
||||||
show_info = {
|
split = {
|
||||||
url = true;
|
horizontal = false;
|
||||||
headers = true;
|
in_place = false;
|
||||||
http_info = true;
|
stay_in_current_window_after_split = true;
|
||||||
curl_command = true;
|
|
||||||
};
|
};
|
||||||
decode_url = true;
|
behavior = {
|
||||||
statistics = {
|
show_info = {
|
||||||
enable = true;
|
url = true;
|
||||||
stats = [
|
headers = true;
|
||||||
{
|
http_info = true;
|
||||||
__unkeyed = "total_time";
|
curl_command = true;
|
||||||
title = "Time taken:";
|
};
|
||||||
}
|
decode_url = true;
|
||||||
{
|
statistics = {
|
||||||
__unkeyed = "size_download_t";
|
enable = true;
|
||||||
title = "Download size:";
|
stats = [
|
||||||
}
|
{
|
||||||
];
|
__unkeyed = "total_time";
|
||||||
};
|
title = "Time taken:";
|
||||||
formatters = {
|
}
|
||||||
json = "jq";
|
{
|
||||||
html.__raw = ''
|
__unkeyed = "size_download_t";
|
||||||
function(body)
|
title = "Download size:";
|
||||||
if vim.fn.executable("tidy") == 0 then
|
}
|
||||||
return body, { found = false, name = "tidy" }
|
];
|
||||||
|
};
|
||||||
|
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
|
end
|
||||||
local fmt_body = vim.fn.system({
|
'';
|
||||||
"tidy",
|
};
|
||||||
"-i",
|
};
|
||||||
"-q",
|
keybinds = {
|
||||||
"--tidy-mark", "no",
|
buffer_local = false;
|
||||||
"--show-body-only", "auto",
|
prev = "H";
|
||||||
"--show-errors", "0",
|
next = "L";
|
||||||
"--show-warnings", "0",
|
|
||||||
"-",
|
|
||||||
}, body):gsub("\n$", "")
|
|
||||||
|
|
||||||
return fmt_body, { found = true, name = "tidy" }
|
|
||||||
end
|
|
||||||
'';
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
keybinds = {
|
highlight = {
|
||||||
buffer_local = false;
|
enable = true;
|
||||||
prev = "H";
|
timeout = 750;
|
||||||
next = "L";
|
|
||||||
};
|
};
|
||||||
|
keybinds = [
|
||||||
|
[
|
||||||
|
"<localleader>rr"
|
||||||
|
"<cmd>Rest run<cr>"
|
||||||
|
"Run request under the cursor"
|
||||||
|
]
|
||||||
|
[
|
||||||
|
"<localleader>rl"
|
||||||
|
"<cmd>Rest run last<cr>"
|
||||||
|
"Re-run latest request"
|
||||||
|
]
|
||||||
|
];
|
||||||
};
|
};
|
||||||
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"
|
|
||||||
]
|
|
||||||
];
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue