mirror of
https://github.com/LazyVim/LazyVim.git
synced 2025-06-22 08:53:33 +02:00
feat(fzf): basic image viewing support
This commit is contained in:
parent
f24999fd36
commit
cda30f2740
1 changed files with 24 additions and 0 deletions
|
@ -84,6 +84,18 @@ return {
|
||||||
end
|
end
|
||||||
fix(defaults)
|
fix(defaults)
|
||||||
|
|
||||||
|
local img_previewer ---@type string[]?
|
||||||
|
for _, v in ipairs({
|
||||||
|
{ cmd = "ueberzug", args = {} },
|
||||||
|
{ cmd = "chafa", args = { "{file}", "--format=symbols" } },
|
||||||
|
{ cmd = "viu", args = { "-b" } },
|
||||||
|
}) do
|
||||||
|
if vim.fn.executable(v.cmd) == 1 then
|
||||||
|
img_previewer = vim.list_extend({ v.cmd }, v.args)
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
return vim.tbl_deep_extend("force", defaults, {
|
return vim.tbl_deep_extend("force", defaults, {
|
||||||
fzf_colors = true,
|
fzf_colors = true,
|
||||||
fzf_opts = {
|
fzf_opts = {
|
||||||
|
@ -93,6 +105,18 @@ return {
|
||||||
-- formatter = "path.filename_first",
|
-- formatter = "path.filename_first",
|
||||||
formatter = "path.dirname_first",
|
formatter = "path.dirname_first",
|
||||||
},
|
},
|
||||||
|
previewers = {
|
||||||
|
builtin = {
|
||||||
|
extensions = {
|
||||||
|
["png"] = img_previewer,
|
||||||
|
["jpg"] = img_previewer,
|
||||||
|
["jpeg"] = img_previewer,
|
||||||
|
["gif"] = img_previewer,
|
||||||
|
["webp"] = img_previewer,
|
||||||
|
},
|
||||||
|
ueberzug_scaler = "fit_contain",
|
||||||
|
},
|
||||||
|
},
|
||||||
-- Custom LazyVim option to configure vim.ui.select
|
-- Custom LazyVim option to configure vim.ui.select
|
||||||
ui_select = function(fzf_opts, items)
|
ui_select = function(fzf_opts, items)
|
||||||
return vim.tbl_deep_extend("force", fzf_opts, {
|
return vim.tbl_deep_extend("force", fzf_opts, {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue