mirror of
https://github.com/folke/snacks.nvim
synced 2025-12-23 08:47:57 +00:00
This commit is contained in:
parent
1bbd47973d
commit
6ea4fa72dc
7 changed files with 807 additions and 365 deletions
|
|
@ -4,7 +4,8 @@ local M = {}
|
|||
---@param buf number
|
||||
---@param opts? snacks.image.Opts|{src?: string}
|
||||
function M.attach(buf, opts)
|
||||
local file = opts and opts.src or vim.api.nvim_buf_get_name(buf)
|
||||
opts = opts or {}
|
||||
local file = opts.src or vim.api.nvim_buf_get_name(buf)
|
||||
if not Snacks.image.supports(file) then
|
||||
local lines = {} ---@type string[]
|
||||
lines[#lines + 1] = "# Image viewer"
|
||||
|
|
@ -28,6 +29,8 @@ function M.attach(buf, opts)
|
|||
modified = false,
|
||||
swapfile = false,
|
||||
})
|
||||
opts.conceal = true
|
||||
opts.auto_resize = true
|
||||
return Snacks.image.placement.new(buf, file, opts)
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue