-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathrest_nvim.lua
More file actions
53 lines (50 loc) · 1.38 KB
/
rest_nvim.lua
File metadata and controls
53 lines (50 loc) · 1.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
return {
"rest-nvim/rest.nvim",
dependencies = {
"nvim-lua/plenary.nvim",
"nvim-treesitter/nvim-treesitter",
"luarocks.nvim",
},
ft = { "http" },
opts = {
skip_ssl_verification = true,
encode_url = true,
highlight = {
enable = true,
timeout = 150,
},
result = {
split = {
horizontal = false,
in_place = false,
},
behavior = {
formatters = {
json = "jq",
html = function(body)
return vim.fn.system({ "tidy", "-i", "-q", "-" }, body)
end,
},
},
},
env_file = ".env",
custom_dynamic_variables = {},
},
config = function(_, opts)
require("rest-nvim").setup(opts)
local function o(desc)
return { desc = desc, buffer = true, silent = true }
end
vim.api.nvim_create_autocmd("FileType", {
group = require("config.util").augroup("rest_nvim"),
pattern = "http",
-- stylua: ignore
callback = function()
vim.keymap.set("n", "<localleader>rr", "<cmd>Rest run<CR>", o("Run the request under cursor"))
vim.keymap.set("n", "<localleader>rp", "<Plug>RestNvimPreview", o("Preview the request cURL command"))
vim.keymap.set("n", "<localleader>R", "<cmd>Rest last<CR>", o("Run the last request"))
end,
})
end,
enabled = require("config.util").is_enabled("rest-nvim/rest.nvim"),
}