diff options
| author | 2026-03-27 14:13:00 +0300 | |
|---|---|---|
| committer | 2026-03-27 14:13:00 +0300 | |
| commit | 3009f160980a3856a54ca387d8c714c35fd94d49 (patch) | |
| tree | d0be23b6bd4e270b0ac33e6047ce808a6ad6da77 /config/nvim/lua/plugins/rest.lua | |
| parent | Added minimap nvim, dap configs, conf syntax(WIP) (diff) | |
| download | dotfiles-3009f160980a3856a54ca387d8c714c35fd94d49.tar.gz dotfiles-3009f160980a3856a54ca387d8c714c35fd94d49.tar.bz2 dotfiles-3009f160980a3856a54ca387d8c714c35fd94d49.tar.xz dotfiles-3009f160980a3856a54ca387d8c714c35fd94d49.zip | |
new version
Diffstat (limited to '')
| -rw-r--r-- | config/nvim/lua/plugins/rest.lua | 65 |
1 files changed, 65 insertions, 0 deletions
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 = { + { + "<leader>rr", + ":Rest run<CR>", + desc = "Run HTTP request", + }, + { + "<leader>rl", + ":Rest last<CR>", + desc = "Run HTTP request (last)", + }, + }, + }, +}
\ No newline at end of file |
