chore(nvim): setup rest-nvim correctly

On version 2.0.0 the installation and configuration were updated.
This commit is contained in:
João Paulo Dubas 2024-03-28 00:12:00 +00:00
parent cd84775ca7
commit 3a2d22e64b
Signed by: joao.dubas
SSH Key Fingerprint: SHA256:V1mixgOGRc/YMhGx/DNkOSmJxgA2vHNrDZEk3wt/kOA

View File

@ -164,37 +164,57 @@ return {
},
opts = {},
},
{
'vhyrro/luarocks.nvim',
priority = 1000,
config = true,
},
{
'rest-nvim/rest.nvim',
dependencies = { 'nvim-lua/plenary.nvim' },
dependencies = { 'luarocks.nvim' },
ft = {
'http',
'rest',
},
opts = {
result_split_horizontal = false,
result_split_in_place = false,
skip_ssl_verification = false,
encode_url = true,
highlight = {
enabled = true,
timeout = 15,
},
result = {
show_url = true,
show_curl_command = true,
show_http_info = true,
show_headers = true,
formatters = {
json = 'jq',
html = false,
},
jump_to_request = true,
env_file = '.env',
config = function()
require('rest-nvim').setup {
client = 'curl',
custom_dynamic_variables = {},
yank_dry_run = true,
},
},
encode_url = true,
env_file = '.env',
skip_ssl_verification = false,
highlight = {
enable = true,
timeout = 15,
},
result = {
behavior = {
decode_url = true,
formatters = {
json = 'jq',
html = false,
},
show_info = {
curl_command = true,
headers = true,
http_info = true,
url = true,
},
statistics = {
enable = true,
stats = {
{ 'total_time', title = 'Time taken:' },
{ 'size_download_t', title = 'Download size:' },
},
},
},
split = {
horizontal = false,
in_place = false,
},
},
}
end,
keys = function()
local status_ok, which_key = pcall(require, 'which-key')
if status_ok then
@ -203,13 +223,13 @@ return {
}
end
return {
{ '<leader>tr', '<Plug>RestNvim', desc = 'Run the request under cursor' },
{ '<leader>tr', '<cmd>Rest run<cr>', desc = 'Run the request under cursor' },
{
'<leader>tp',
'<Plug>RestNvimPreview',
desc = 'Preview the curl command for the request under cursor',
},
{ '<leader>tl', '<Plug>RestNvimLast', desc = 'Re-run the last request' },
{ '<leader>tl', '<cmd>Rest run last<cr>', desc = 'Re-run the last request' },
}
end,
},