From a92f1cce23d9b5bf29f64fd101554c0188f4d0a1 Mon Sep 17 00:00:00 2001 From: Junegunn Choi Date: Thu, 27 Aug 2026 00:02:54 +0900 Subject: [PATCH] Reuse s:edit_cmds for a tag in the file already shown The tag branch edited the file unconditionally, unlike every other kind, so showing a tag in the window's own buffer reloaded it and reset the undo history. s:tags_sink does not re-edit either. --- autoload/fzf/vim.vim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/autoload/fzf/vim.vim b/autoload/fzf/vim.vim index 98e14ac..8af87c5 100755 --- a/autoload/fzf/vim.vim +++ b/autoload/fzf/vim.vim @@ -723,8 +723,8 @@ function! s:goto_entry(winid, bufnr, dir, kind, entry) abort if empty(excmd) || !filereadable(path) return endif - let cmds = ['keepalt keepjumps hide edit '.s:escape(path), - \ 'keepjumps '.excmd, 'normal! ^zvzz'] + let cmds = s:edit_cmds(a:winid, path) + \ + ['keepjumps '.excmd, 'normal! ^zvzz'] elseif a:kind ==# 'btags' let parts = split(entry, "\t") if len(parts) < 3 || !bufexists(a:bufnr)