Skip to content

Commit cff103b

Browse files
authored
Merge pull request #96 from blackadress/config-request-buffer-placement
2 parents 2826f69 + 5360d6f commit cff103b

File tree

4 files changed

+11
-1
lines changed

4 files changed

+11
-1
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ use {
6161
require("rest-nvim").setup({
6262
-- Open request results in a horizontal split
6363
result_split_horizontal = false,
64+
-- Keep the http file buffer above|left when split horizontal|vertical
65+
result_split_in_place = false,
6466
-- Skip SSL verification, useful for unknown certificates
6567
skip_ssl_verification = false,
6668
-- Highlight request on run
@@ -110,6 +112,8 @@ To run `rest.nvim` you should map the following commands:
110112

111113
- `result_split_horizontal` opens result on a horizontal split (default opens
112114
on vertical)
115+
- `result_split_in_place` opens result below|right on horizontal|vertical split
116+
(default opens top|left on horizontal|vertical split)
113117
- `skip_ssl_verification` passes the `-k` flag to cURL in order to skip SSL verification,
114118
useful when using unknown certificates
115119
- `highlight` allows to enable and configure the highlighting of the selected request when send,

doc/rest-nvim.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ function, it looks like this by default:
5454
`require("rest-nvim").setup({`
5555
` -- Open request results in a horizontal split`
5656
` result_split_horizontal = false,`
57+
` -- Keep the http file buffer above|left when split horizontal|vertical
58+
` result_split_in_place = false,
5759
` -- Skip SSL verification, useful for unknown certificates`
5860
` skip_ssl_verification = false,`
5961
` -- Highlight request on run`

lua/rest-nvim/config/init.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ local M = {}
22

33
local config = {
44
result_split_horizontal = false,
5+
result_split_in_place = false,
56
skip_ssl_verification = false,
67
highlight = {
78
enabled = true,

lua/rest-nvim/curl/init.lua

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,12 @@ local function create_callback(method, url)
101101
-- Only open a new split if the buffer is not loaded into the current window
102102
if vim.fn.bufwinnr(res_bufnr) == -1 then
103103
local cmd_split = [[vert sb]]
104-
if config.result_split_horizontal then
104+
if config.get("result_split_horizontal") then
105105
cmd_split = [[sb]]
106106
end
107+
if config.get("result_split_in_place") then
108+
cmd_split = [[bel ]] .. cmd_split
109+
end
107110
vim.cmd(cmd_split .. res_bufnr)
108111
-- Set unmodifiable state
109112
vim.api.nvim_buf_set_option(res_bufnr, "modifiable", false)

0 commit comments

Comments
 (0)