forked from rest-nvim/rest.nvim
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinit.lua
More file actions
71 lines (65 loc) · 1.55 KB
/
init.lua
File metadata and controls
71 lines (65 loc) · 1.55 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
local M = {}
local config = {
result_split_horizontal = false,
result_split_in_place = false,
stay_in_current_window_after_split = false,
skip_ssl_verification = false,
encode_url = true,
highlight = {
enabled = true,
timeout = 150,
},
result = {
show_curl_command = true,
show_url = true,
show_http_info = true,
show_headers = true,
show_statistics = false,
formatters = {
json = "jq",
html = function(body)
if vim.fn.executable("tidy") == 0 then
return body
end
-- stylua: ignore
return vim.fn.system({
"tidy", "-i", "-q",
"--tidy-mark", "no",
"--show-body-only", "auto",
"--show-errors", "0",
"--show-warnings", "0",
"-",
}, body):gsub("\n$", "")
end,
},
},
jump_to_request = false,
env_file = ".env",
env_pattern = "\\.env$",
env_edit_command = "tabedit",
custom_dynamic_variables = {},
yank_dry_run = true,
search_back = true,
}
--- Get a configuration value
--- @param opt string
--- @return any
M.get = function(opt)
-- If an option was passed then
-- return the requested option.
-- Otherwise, return the entire
-- configurations.
if opt then
return config[opt]
end
return config
end
--- Set user-defined configurations
--- @param user_configs table
--- @return table
M.set = function(user_configs)
vim.validate({ user_configs = { user_configs, "table" } })
config = vim.tbl_deep_extend("force", config, user_configs)
return config
end
return M