mirror of
https://github.com/folke/snacks.nvim
synced 2025-08-04 18:58:12 +00:00
feat(picker.lines): jump to first position of match. Closes #806
This commit is contained in:
parent
56db8f14bf
commit
ae897f329f
4 changed files with 22 additions and 2 deletions
|
@ -83,8 +83,12 @@ function M.jump(picker, _, action)
|
|||
vim.api.nvim_win_set_buf(win, buf)
|
||||
|
||||
-- set the cursor
|
||||
if item.pos and item.pos[1] > 0 then
|
||||
vim.api.nvim_win_set_cursor(win, { item.pos[1], item.pos[2] })
|
||||
local pos = item.pos
|
||||
if picker.opts.jump.match then
|
||||
pos = picker.matcher:bufpos(buf, item) or pos
|
||||
end
|
||||
if pos and pos[1] > 0 then
|
||||
vim.api.nvim_win_set_cursor(win, { pos[1], pos[2] })
|
||||
elseif item.search then
|
||||
vim.cmd(item.search)
|
||||
vim.cmd("noh")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue