fix: image.nvim previews with preview_method=scratch

This commit is contained in:
Steven Arcangeli 2024-11-21 17:36:22 -08:00
parent bf81e2a79a
commit 5acab3d8a9
2 changed files with 27 additions and 1 deletions

View file

@ -534,7 +534,11 @@ M.open_preview = function(opts, callback)
local entry_is_file = not vim.endswith(normalized_url, "/")
local filebufnr
if entry_is_file and config.preview_win.preview_method ~= "load" then
if
entry_is_file
and config.preview_win.preview_method ~= "load"
and not util.file_matches_bufreadcmd(normalized_url)
then
filebufnr =
util.read_file_to_scratch_buffer(normalized_url, config.preview_win.preview_method)
end