@@ -691,9 +691,11 @@ function Previewer.buffer_or_file:parse_entry(entry_str, _cb)
691691 end
692692 if entry .path then
693693 if entry .path :find (" ^fugitive://" ) and buf and api .nvim_buf_is_valid (buf ) then
694- entry .do_not_cache = true
695- api .nvim_buf_call (buf ,
696- function () vim .cmd ((" do fugitive BufReadCmd %s" ):format (entry .path )) end )
694+ if fn .exists (" #fugitive#BufReadCmd" ) == 1 then
695+ api .nvim_buf_call (buf , function ()
696+ api .nvim_exec_autocmds (" BufReadCmd" , { group = " fugitive" , pattern = entry .path })
697+ end )
698+ end
697699 return entry
698700 end
699701 entry .tick = vim .tbl_get (uv .fs_stat (entry .path ) or {}, " mtime" , " nsec" )
@@ -855,25 +857,21 @@ end
855857--- @param entry fzf-lua.buffer_or_file.Entry
856858--- @return string ?
857859function Previewer .buffer_or_file :key_from_entry (entry )
860+ if entry .do_not_cache then return nil end
858861 return (entry .bufnr and string.format (" bufnr:%d" , entry .bufnr ) or entry .uri or entry .path ) or nil
859862end
860863
861864--- get and check if cached is update-to-date to be reuse
862865--- @param entry fzf-lua.buffer_or_file.Entry
863866--- @return fzf-lua.buffer_or_file.Bcache ?
864867function Previewer .buffer_or_file :check_bcache (entry )
865- if entry .do_not_cache then return end
866868 local key = self :key_from_entry (entry )
867869 if not key then return end
868870 local cached = self .cached_buffers [key ]
869871 if not cached then return end
870872 entry .cached = cached
871873 assert (self .cached_bufnrs [cached .bufnr ])
872874 assert (api .nvim_buf_is_valid (cached .bufnr ))
873- if not cached .tick then -- in case cache don't have "tick"
874- assert (cached .tick == entry .tick )
875- return cached
876- end
877875 if entry .tick ~= cached .tick then
878876 cached .invalid = true
879877 cached .tick = entry .tick
@@ -1479,12 +1477,10 @@ function Previewer.buffer_or_file:preview_buf_post(entry, min_winopts)
14791477
14801478 -- Should we cache the current preview buffer?
14811479 -- we cache only named buffers with valid path/uri
1482- if not entry .do_not_cache and self .preview_bufnr then
1483- local key = self :key_from_entry (entry )
1484- if not key then return end
1485- local cached = self :cache_buffer (self .preview_bufnr , key , min_winopts )
1486- cached .tick = entry .tick
1487- end
1480+ local key = self :key_from_entry (entry )
1481+ if not key then return end
1482+ local cached = self :cache_buffer (self .preview_bufnr , key , min_winopts )
1483+ cached .tick = entry .tick
14881484end
14891485
14901486--- @class fzf-lua.previewer.HelpTags : fzf-lua.previewer.BufferOrFile , {}
0 commit comments