Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lua/snacks/picker/config/defaults.lua
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ local defaults = {
max_size = 1024 * 1024, -- 1MB
max_line_length = 500, -- max line length
ft = nil, ---@type string? filetype for highlighting. Use `nil` for auto detect
use_real_buffer = true ---@type boolean use actual buffer as preview when the file is already loaded (default: true)
},
man_pager = nil, ---@type string? MANPAGER env to use for `man` preview
},
Expand Down
2 changes: 1 addition & 1 deletion lua/snacks/picker/preview.lua
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ function M.file(ctx)
vim.fn.bufload(ctx.item.buf)
end

if ctx.item.buf and vim.api.nvim_buf_is_loaded(ctx.item.buf) then
if ctx.item.buf and vim.api.nvim_buf_is_loaded(ctx.item.buf) and ctx.picker.opts.previewers.file.use_real_buffer then
if not title then
local name = vim.api.nvim_buf_get_name(ctx.item.buf)
title = uv.fs_stat(name) and vim.fn.fnamemodify(name, ":t") or name
Expand Down