⚙️ config(nvim): use rest-client included in lazyvim instead of custom one

This commit is contained in:
Sergio Laín 2024-09-03 11:55:49 +02:00
parent 812e1e3b66
commit 7dc87763b9
No known key found for this signature in database
GPG key ID: 8429B2EE312F8150
2 changed files with 16 additions and 70 deletions

View file

@ -1,70 +0,0 @@
local prefix = "<leader>th"
return {
{
"nvim-treesitter/nvim-treesitter",
opts = function(_, opts)
if type(opts.ensure_installed) == "table" then
vim.list_extend(opts.ensure_installed, { "http" })
end
end,
},
{
"rest-nvim/rest.nvim",
ft = "http",
opts = {
-- Open request results in a horizontal split
result_split_horizontal = true,
-- Keep the http file buffer above|left when split horizontal|vertical
result_split_in_place = false,
-- Skip SSL verification, useful for unknown certificates
skip_ssl_verification = false,
-- Encode URL before making request
encode_url = true,
-- 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,
-- executables or functions for formatting response body [optional]
-- set them to false if you want to disable them
formatters = {
json = "jq",
html = function(body)
return vim.fn.system({ "tidy", "-i", "-q", "-" }, body)
end,
},
},
-- Jump to request line on run
jump_to_request = false,
env_file = ".env",
custom_dynamic_variables = {},
yank_dry_run = true,
},
config = function(_, opts)
require("rest-nvim").setup(opts)
LazyVim.on_load("telescope.nvim", function()
require("telescope").load_extension("rest")
end)
end,
-- stylua: ignore
keys = {
{ prefix .. "p", function() require("rest-nvim").run(true) end, desc = "Preview Request" },
{ prefix .. "r", function() require("rest-nvim").run() end, desc = "Run Request" },
{ "<leader>sv", function() require("telescope").extensions.rest.select_env() end, desc = "Env Files" },
},
},
{
"folke/which-key.nvim",
opts = {
spec = {
{ prefix, group = "http", icon = "󱞒 " },
},
},
},
}

View file

@ -0,0 +1,16 @@
return {
{ import = "lazyvim.plugins.extras.util.rest" },
{
"mistweaverco/kulala.nvim",
opts = {
icons = {
inlay = {
loading = "󰔟",
done = "",
error = "",
},
lualine = "",
},
},
},
}