Preview images Thumbnails for different kind of files, from Neovim using Telescope + ASCII Art (whit Chafa). Support Tmux + console kitty.
jpg | png | jpeg | svg | gif | avi | mp4 | wmv | dat | 3gp | ogv | mkv | mpg | mpeg | vob | m2v | mov | webm | mts | m4v | rm | qt | divx | pdf | epub | ttf | otf | woff | webp
⭐ Important: If you like, let your star
return {
"mgallegoa/telescope-media-files.nvim",
dependencies = {
"nvim-lua/plenary.nvim",
"nvim-telescope/telescope.nvim",
"nvim-lua/popup.nvim"
},
}
require('telescope').load_extension('media_files')
This extension can be configured using extensions
field inside Telescope setup function.
In the next example, the filetypes is configure to accept other types of files (check the Prerequisites section optional) and change the default find command (fd) to rg -->
config = function()
local telescope = require('telescope')
telescope.setup({
extensions = {
media_files = {
filetypes = { "png", "jpg", "jpeg", "webp", "svg", "gif", "pdf", "epub", "ttf", "mp4", "3gp", "mpeg" }, -- default {"png", "jpg", "mp4", "webm", "pdf"}
find_cmd = "rg", -- find command defaults to `fd`
-- command_open_imen = "display" -- Example to use imageMagick to show the image instead default eog
-- command_open_image = 'gnome-terminal -- env TMUX="" kitty --hold kitten ica' -- Example to use the kitty terminal for the images
-- command_open_thumbnail = "kitten icat" -- Example open image Thumbnail with kitty
-- show_file_details = 0 -- Example to disable the file details.
-- tmux_always_open_pane = 1 -- Example to open a new pane in tmux for each Thumbnail
-- tmux_time_wait = 1 -- Example to wait 1 second for console render the image
-- tmux_index_pane_thumbnail = 0 -- Example to show the Thumbnail at the left of the tmux pane.
-- tmux_resize_open_pane = 30 -- Example of number of columns to open the tmux pane.
}
},
})
end,
keys = {
{ "<leader>fm", "<cmd>lua require('telescope').extensions.media_files.media_files()<cr>" },
{ "<leader>fn", "<cmd>lua require('telescope').extensions.media_files.media_files_console()<cr>" },
}
💡 Tip: See the list of the config variables you can used to custom your view
Over the file Ctl+i to open an image of the file (default viewer eog, but can be configured to other external viewer)
:Telescope media_files
lua require('telescope').extensions.media_files.media_files()
lua require('telescope').extensions.media_files.media_files_console()
or using key-binding
:Telescope media_files.media_files()
:Telescope media_files.media_files_console()
keys = {
{ "<leader>fm", "<cmd>lua require('telescope').extensions.media_files.media_files()<cr>" },
{ "<leader>fn", "<cmd>lua require('telescope').extensions.media_files.media_files_console()<cr>" },
}
When you press <Enter>
on a selected file, normal mode, it will copy its relative path to the clipboard
- Chafa : ASCII Art Image support ( Tmux + kitten required kitten icat )
- fd : To find the files in Telescope pop up. Also support rg / find, find or fdfind in Ubuntu/Debian.
- file : To view detailed information for the file at the buttom of the Thumbnail
- rsvg-convert : For svg previews
- ffmpegthumbnailer : for video preview support
- pdftoppm : for pdf preview support. Available in the AUR as poppler package.
- epub-thumbnailer : for epub preview support.
- fontpreview : for font preview support. But it is necessary to install imageMagic version > 7 to work correctly (https://github.com/ImageMagick/ImageMagick) and follow the insatallation accourding to your system, for example in Unix (https://github.com/ImageMagick/ImageMagick/blob/main/Install-unix.txt)
- ffmpeg : Use for webp previews.
- Know errors/issues and how to fix contain a list of know and document errors/issues and how to fix it.
- Tested environments contain information of different environments test and work well.
credit to https://github.com/cirala/vifmimg