diff options
| author | Ariel D'Alessandro <ariel.dalessandro@auto1.com> | 2022-04-12 20:10:58 +0200 |
|---|---|---|
| committer | Ariel D'Alessandro <ariel.dalessandro@auto1.com> | 2022-04-12 20:10:58 +0200 |
| commit | 2f09ab84a13e114b8a1585b55ba62e8d31c59370 (patch) | |
| tree | 0f6018b8489aadfe6c9d251da6558bdbcf578507 /after/plugin/rest.lua | |
| parent | 2d526b3a2499bcef17f1dccc61377b52c3cdced7 (diff) | |
| download | nvim-conf-2f09ab84a13e114b8a1585b55ba62e8d31c59370.tar.gz nvim-conf-2f09ab84a13e114b8a1585b55ba62e8d31c59370.zip | |
Add new plugin for http not blocking
Diffstat (limited to 'after/plugin/rest.lua')
| -rw-r--r-- | after/plugin/rest.lua | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/after/plugin/rest.lua b/after/plugin/rest.lua new file mode 100644 index 0000000..baf4edd --- /dev/null +++ b/after/plugin/rest.lua @@ -0,0 +1,37 @@ +local ok, rest_nvim = pcall(require, "rest-nvim") +if not ok then + return +end + +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("<abuf>"), 10) + vim.keymap.set("n", "<leader>rn", rest_nvim.run, { noremap = true, buffer = buff }) + vim.keymap.set("n", "<leader>rl", rest_nvim.last, { noremap = true, buffer = buff }) + end +}) + |