From 5455aacdedfb2829f000b2f120a6d5194d1227f8 Mon Sep 17 00:00:00 2001 From: Ariel D'Alessandro Date: Sun, 22 Jan 2023 10:18:07 +0100 Subject: feat: big change on the structure of the plugins, move several things to config dir --- lua/plugins/rest.lua | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 lua/plugins/rest.lua (limited to 'lua/plugins/rest.lua') diff --git a/lua/plugins/rest.lua b/lua/plugins/rest.lua new file mode 100644 index 0000000..7b60a9d --- /dev/null +++ b/lua/plugins/rest.lua @@ -0,0 +1,42 @@ +return { + "NTBBloodbath/rest.nvim", + dependencies = { "nvim-lua/plenary.nvim" }, + ft = "http", + config = function() + local rest_nvim = require("rest-nvim") + + rest_nvim.setup({ + -- Open request results in a horizontal split + result_split_horizontal = false, + -- Skip SSL verification, useful for unknown certificates + skip_ssl_verification = false, + -- Highlight request on run + highlight = { + enabled = true, + timeout = 150, + }, + result = { + -- toggle showing URL, HTTP info, headers at top the of result window + show_url = true, + show_http_info = true, + show_headers = true, + }, + -- Jump to request line on run + jump_to_request = false, + env_file = ".env", + custom_dynamic_variables = {}, + yank_dry_run = true, + }) + + vim.api.nvim_create_autocmd("FileType", { + pattern = "http", + callback = function() + local buff = tonumber(vim.fn.expand(""), 10) + vim.keymap.set("n", "rn", rest_nvim.run, { noremap = true, buffer = buff }) + vim.keymap.set("n", "rl", rest_nvim.last, { noremap = true, buffer = buff }) + vim.keymap.set("n", "rp", function() rest_nvim.run(true) end, { noremap = true, buffer = buff }) + end + }) + + end +} -- cgit v1.2.3