From 3009f160980a3856a54ca387d8c714c35fd94d49 Mon Sep 17 00:00:00 2001 From: Alexander Neonxp Kiryukhin Date: Fri, 27 Mar 2026 14:13:00 +0300 Subject: new version --- config/nvim/lua/plugins/rest.lua | 65 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 config/nvim/lua/plugins/rest.lua (limited to 'config/nvim/lua/plugins/rest.lua') diff --git a/config/nvim/lua/plugins/rest.lua b/config/nvim/lua/plugins/rest.lua new file mode 100644 index 0000000..f57b218 --- /dev/null +++ b/config/nvim/lua/plugins/rest.lua @@ -0,0 +1,65 @@ +return { + { + "rest-nvim/rest.nvim", + event = "VeryLazy", + dependencies = { + "nvim-lua/plenary.nvim", + "nvim-neotest/nvim-nio", + }, + build = ":UpdateRemotePlugins", + config = function() + require("rest-nvim").setup({ + -- Open request results in a horizontal split + split = { + horizontal = false, -- split horizontally + width = 0.4, -- split width, number represents percentage of screen + }, + -- Skip SSL verification + skip_ssl_verification = false, + -- Encode URL characters + encode_url = true, + -- Highlight response + highlight = { + enabled = true, + timeout = 200, + }, + -- Dynamic URL variable interpolation + dynamic_variables = {}, + -- Default headers + default_headers = { + ["Content-Type"] = "application/json", + }, + -- Custom curl arguments + curl_args = { + ["--max-time"] = 30, + }, + -- Format response body using gq command + response = { + hooks = { + format = true, + }, + }, + }) + + -- Set formatprg for JSON formatting + vim.api.nvim_create_autocmd({ "FileType" }, { + pattern = "json", + callback = function(args) + vim.bo[args.buf].formatprg = "jq --indent 4" + end, + }) + end, + keys = { + { + "rr", + ":Rest run", + desc = "Run HTTP request", + }, + { + "rl", + ":Rest last", + desc = "Run HTTP request (last)", + }, + }, + }, +} \ No newline at end of file -- cgit v1.2.3