From b4a045f8b42d5637b0ec8327dd88e51aea6c3709 Mon Sep 17 00:00:00 2001 From: Junegunn Choi Date: Mon, 28 Sep 2026 06:44:54 +0900 Subject: [PATCH] Put the starting window back before the action opens the tag The loop opens each entry of a multi-selection in the starting window, so giving the survivor's action that window left it on the tag's file, and 'ctrl-v' showed the tag twice. Restore buffer and view first, as the quickfix branch does, then open where the key asks and go to the line the entry reached. --- autoload/fzf/vim.vim | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/autoload/fzf/vim.vim b/autoload/fzf/vim.vim index 41bbca1..c1e4550 100755 --- a/autoload/fzf/vim.vim +++ b/autoload/fzf/vim.vim @@ -1850,9 +1850,13 @@ function! s:tags_sink(from, lines) call s:fill_quickfix('tags', qfl) elseif len(qfl) == 1 " Entries opened in the loop take the action only when one was selected, so - " the last one standing of a multi-selection still owes the key its action + " the last one standing of a multi-selection still owes the key its action. + " The loop opened it in the starting window, which goes back as it was first if len(list) > 1 - call s:action_for(key, qfl[0].filename, 1) + call s:execute_silent('b '.buf) + call winrestview(view) + call s:action_for(key, qfl[0].filename) + call cursor(qfl[0].lnum, 1) endif normal! ^zvzz endif