Skip to content

Commit 87c8e55

Browse files
author
jetgeng
committed
add search_back option
1 parent aea7c64 commit 87c8e55

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

lua/rest-nvim/config/init.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ local config = {
3636
env_file = ".env",
3737
custom_dynamic_variables = {},
3838
yank_dry_run = true,
39+
search_back = true ,
3940
}
4041

4142
--- Get a configuration value

lua/rest-nvim/request/init.lua

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,12 @@ local function start_request(bufnr, linenumber)
218218
local oldlinenumber = linenumber
219219
utils.move_cursor(bufnr, linenumber)
220220

221-
local res = vim.fn.search("^GET\\|^POST\\|^PUT\\|^PATCH\\|^DELETE", "cn")
221+
local res
222+
if config.get("search_back") then
223+
res = vim.fn.search("^GET\\|^POST\\|^PUT\\|^PATCH\\|^DELETE", "cb")
224+
else
225+
res = vim.fn.search("^GET\\|^POST\\|^PUT\\|^PATCH\\|^DELETE", "cn")
226+
end
222227
-- restore cursor position
223228
utils.move_cursor(bufnr, oldlinenumber)
224229

0 commit comments

Comments
 (0)