diff options
| author | Ariel D'Alessandro <dalessandro.ariel@gmail.com> | 2023-01-17 23:53:34 +0100 |
|---|---|---|
| committer | Ariel D'Alessandro <dalessandro.ariel@gmail.com> | 2023-01-18 09:03:37 +0100 |
| commit | a04f9cd914055244f29e9ff17aa7a723f5db2405 (patch) | |
| tree | 703edf280638e30fe77dd46a60a2e5442e8fd33a /lua/alpha/plugins/rest.lua | |
| parent | ec9655746b21d5ffb01caf502cf9047f83fc3753 (diff) | |
| download | nvim-conf-a04f9cd914055244f29e9ff17aa7a723f5db2405.tar.gz nvim-conf-a04f9cd914055244f29e9ff17aa7a723f5db2405.zip | |
feat: migration to lazy
Diffstat (limited to 'lua/alpha/plugins/rest.lua')
| -rw-r--r-- | lua/alpha/plugins/rest.lua | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/lua/alpha/plugins/rest.lua b/lua/alpha/plugins/rest.lua new file mode 100644 index 0000000..a0ec729 --- /dev/null +++ b/lua/alpha/plugins/rest.lua @@ -0,0 +1,41 @@ +return { + "NTBBloodbath/rest.nvim", + dependencies = { "nvim-lua/plenary.nvim" }, + 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("<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 }) + vim.keymap.set("n", "<leader>rp", function() rest_nvim.run(true) end, { noremap = true, buffer = buff }) + end + }) + + end +} |