From 0ce4cca7bd8e60e4c581f9d555256e30748ac980 Mon Sep 17 00:00:00 2001 From: Junegunn Choi Date: Mon, 28 Sep 2026 03:36:17 +0900 Subject: [PATCH] Leave the cursor alone when no tag was opened Refusing the address of a single selected tag leaves the quickfix list empty, and 'normal! ^zvzz' then moved the cursor in whatever buffer the user was in. --- autoload/fzf/vim.vim | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/autoload/fzf/vim.vim b/autoload/fzf/vim.vim index 0978811..718c5d1 100755 --- a/autoload/fzf/vim.vim +++ b/autoload/fzf/vim.vim @@ -547,6 +547,7 @@ function! s:sandboxed(cmd) return 'sandbox execute '.string(a:cmd) endfunction + " Address of a tag, given the rest of the line after the file name, or, with " 'whole' off, the address field alone as :BTags reads it. Only the forms a tags " file is meant to hold, a line number and a search pattern, chained with ';' for @@ -1735,7 +1736,7 @@ function! s:btags_sink(from, lines) normal! g`' " Because 'listproc' will use 'cfirst' to go to the first item in the list call s:fill_quickfix('btags', qfl) - else + elseif len(qfl) == 1 normal! zvzz endif if !empty(tagname) @@ -1835,7 +1836,7 @@ function! s:tags_sink(from, lines) call s:action_for(key, qfl[0].filename, 1) call s:fill_quickfix('tags', qfl) - else + elseif len(qfl) == 1 normal! ^zvzz endif if !empty(tagname)