telescope-media-files.nvim
telescope-media-files.nvim copied to clipboard
Images are pixelated
I'm using lunarvim and I have enabled this but images are pixelated in kitty.
I can share my wholej config if you'd like
lvim.builtin.telescope.on_config_done = function(telescope)
pcall(telescope.load_extension, "media_files")
end
local previewers = require("telescope.previewers")
lvim.builtin.telescope.register_previewer = function(telescope)
local new_maker = function(filepath, bufnr, opts)
opts = opts or {}
filepath = vim.fn.expand(filepath)
job_id = vim.loop.spawn('kitty', {
args = {'+kitten', 'icat', '--place', opts.x..'%', opts.y..'%', '--silent', filepath},
detached = true
}, function(code)
-- command finished
end)
return bufnr
end
local get_command = function(filepath)
return {
"kitty",
"+kitten",
"icat",
"--silent",
"--sacle",
filepath
}
end
telescope.extensions.media_files.previewer = previewers.new_termopen_previewer({
get_bufnr = new_maker,
get_command = get_command
})
end
lvim.builtin.telescope.on_config_done = function(telescope)
-- telescope.setup {
-- defaults = {
-- file_previewer = require('telescope.previewers').vim_buffer_cat.new,
-- },
-- extensions = {
-- media_files = {
-- filetypes = {"png", "jpg", "mp4", "pdf", "gif"},
-- file_previewer = require('telescope.previewers').ueberzug_maker({
-- display_method = 'kitty'
-- }),
-- find_cmd = "fd"
-- }
-- }
-- }
local previewers = require('telescope.previewers')
local new_maker = function(filepath, bufnr, opts)
opts = opts or {}
filepath = vim.fn.expand(filepath)
job_id = vim.loop.spawn('kitty', {
args = {'+kitten', 'icat', '--place', opts.x..'%', opts.y..'%', '--silent', filepath},
detached = true
}, function(code)
-- command finished
end)
return bufnr
end
local get_command = function(filepath)
return {
"kitty",
"+kitten",
"icat",
"--silent",
"--sacle",
filepath
}
end
telescope.setup {
defaults = {
file_previewer = require('telescope.previewers').vim_buffer_cat.new,
media_files = {
file_previewer = previewers.new_termopen_previewer({
get_bufnr = new_maker,
get_command = get_command
})
}
},
extensions = {
media_files = {
filetypes = {"png", "jpg", "mp4", "pdf", "gif"},
find_cmd = "fd"
}
}
}
telescope.extensions.media_files.use_ueberzug = false
telescope.extensions.media_files.previewer = previewers.new_termopen_previewer({
get_bufnr = new_maker,
get_command = get_command
})
telescope.load_extension("media_files")
end
That's what I tried but same thing
duplicate of #46 I still haven't found a fix....
Looking at the chafa website, it seems to me that this is expected behaviour.
EDIT: Actually, when running the chafa command inside kitty terminal, images show up normally.
This Neovim issue appears related: :term should forward unknown sequences to host
all solutions I tried so far has this same issue of pixelated images, except for yazi that I found out recently.. from my long list of tested alternatives was the first one looking good under tmux
Hope we can have this fixed for telescope extensions .. would be really nice