Skip to content

Commit f7cd51c

Browse files
authored
Merge pull request #210 from jetgeng/main
In most instances, users cursor is below start_request line. if user want to send request, he/she must jump to one line which above or the start_request line. so i add a option, allow user change search direct.
2 parents 45b5220 + 6fe28fd commit f7cd51c

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
@@ -38,6 +38,7 @@ local config = {
3838
env_file = ".env",
3939
custom_dynamic_variables = {},
4040
yank_dry_run = true,
41+
search_back = true ,
4142
}
4243

4344
--- Get a configuration value

lua/rest-nvim/request/init.lua

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,12 @@ local function start_request(bufnr, linenumber)
192192
local oldlinenumber = linenumber
193193
utils.move_cursor(bufnr, linenumber)
194194

195-
local res = vim.fn.search("^GET\\|^POST\\|^PUT\\|^PATCH\\|^DELETE", "bcnW")
195+
local res
196+
if config.get("search_back") then
197+
res = vim.fn.search("^GET\\|^POST\\|^PUT\\|^PATCH\\|^DELETE", "cb")
198+
else
199+
res = vim.fn.search("^GET\\|^POST\\|^PUT\\|^PATCH\\|^DELETE", "cn")
200+
end
196201
-- restore cursor position
197202
utils.move_cursor(bufnr, oldlinenumber)
198203

0 commit comments

Comments
 (0)