Open singlexyz opened 3 years ago
Any updates on this? I'd love to get this working on mac
Any updates on this?
Macos support +1.
Hey guys! FYI, if anyone is looking for how to install ueberzug on macOS
...
I found:
creating or adding
[build_ext]
include_dirs=/opt/X11/include
library_dirs=/opt/X11/lib
to ~/.pydistutils.cfg
as per this article, plus addtionally
installing xquartz
as downloadable on their website ...
I finally am able to successfully install uberzug
on my macOS Monterey v12.1
...
via pip3 install --user ueberzug
I'm not sure yet if that makes it work alltogether, I've only just successfully installed ueberzug
...
Hey guys! FYI, if anyone is looking for
how to install ueberzug on macOS
... I found: creating or adding[build_ext] include_dirs=/opt/X11/include library_dirs=/opt/X11/lib
to
~/.pydistutils.cfg
as per this article, plus addtionally installingxquartz
as downloadable on their website ... I finally am able to successfully installuberzug
on mymacOS Monterey v12.1
... viapip3 install --user ueberzug
I'm not sure yet if that makes it work alltogether, I've only just successfully installed
ueberzug
...
so, after adapting this very plugin - which initially forcefully bails out on darwin/macOS (just deleting this portion of the plugin script) - and installing my fork in my nvim-cfg ... I found I didn't get the simple bailout msg ... but some error msg ...
If anyone has some knowledge of ueberzug
and its usage, or if the author or somebody could have a look if this is fixable with reasonable efforts ... I'd love to use this plugin on my mac :-)
BTW, I'm using zsh and I found this to be a bash-script or so ... maybe the syntax error is to be overcome in a very few simple steps, but I lack knowledge and am out of time/energy ...
please support macos
Does anyone have a high-level idea of what a solution for MacOS would look like? What are the current blockers?
Happy to collaborate and take a stab at it.
Would also be happy to lend a hand if people so desire, at this point I feel it might be easier to build a new Telescope extension from the ground up specifically for macos.
What about using imgcat? we can display images in iterm2
I feel like this is probably the best option. @jswent you want to start collaborating on this? I can start a slack channel or discord or something
What about using imgcat? we can display images in iterm2
imgcat
looks awesome thanks. Probably a good starting point. I was able to get it working no problem on macOS with Alacritty terminal.
I found a way to use viu with this plugin. Here is the config I found
require("telescope").setup({
defaults = {
preview = {
mime_hook = function(filepath, bufnr, opts)
local is_image = function(filepath)
local image_extensions = { "png", "jpg", "jpeg", "gif" } -- Supported image formats
local split_path = vim.split(filepath:lower(), ".", { plain = true })
local extension = split_path[#split_path]
return vim.tbl_contains(image_extensions, extension)
end
if is_image(filepath) then
local term = vim.api.nvim_open_term(bufnr, {})
local function send_output(_, data, _)
for _, d in ipairs(data) do
vim.api.nvim_chan_send(term, d .. "\r\n")
end
end
vim.fn.jobstart({
"viu",
filepath,
}, {
on_stdout = send_output,
stdout_buffered = true,
})
else
require("telescope.previewers.utils").set_preview_message(
bufnr,
opts.winid,
"Binary cannot be previewed"
)
end
end,
},
},
})
require("telescope").load_extension("media_files")
I use Alacritty and the image quality is pretty shit but at least I got a peek of what the images look like, maybe iterm2 and kitty would be better.
hey guys! Just saw this interesting option in the last comment by @howarddo2208 :-) It didn't work for me, as the media_files plugin didn't seem to pick up that hook and I didn't know where to go from there ...
So anyway, I found a way that might be of interest to other guys on MacOS or on any platform that supports the viu
cli image viewer :-) And this time it's really easy ...
All one has to do, is tinker a bit with a fork of this repo and replace the line in the plugin where it calls the ueberzug script with a simple string viu
... that's it.
Basically like that:
M.media_preview = defaulter(function(opts)
return previewers.new_termopen_previewer {
get_command = function(entry)
local tmp_table = vim.split(entry.value, "\t");
local preview = opts.get_preview_window()
opts.cwd = opts.cwd and vim.fn.expand(opts.cwd) or vim.loop.cwd()
if vim.tbl_isempty(tmp_table) then
return { "echo", "" }
end
return {
'viu',
string.format([[%s/%s]], opts.cwd, tmp_table[1]),
preview.col,
preview.line + 1,
preview.width,
preview.height
}
end
}
end, {})
Also, I did fork that already, so, if you just wanna give it a shot if it works for you, you might want to temporarily try my unmaintained fork here: github.com/joehannes-os/telescope-media-files.nvim ...
Cheers 🥳
ohh, and an example of what that looks like, also including my unfinished cleanup ...
@joehannes nice job, but you're a monster, use dark theme right now!
There is also a PR that replaces Ueberzug with viu https://github.com/nvim-telescope/telescope-media-files.nvim/pull/35
which looked pretty good, i only had one nit otherwise it would have been merged already
jep been working on this for a while. sad that I didn't see this comment before, Pull request has its kinks fixed now. should be good to merge.
Feel free to use it as a base-point for hologram or other better non pixelated solutions. My next stop after getting this merged is going to be svg preview
I would love to see this feature merged. Wondering whether this issue could receive more attention if the title would be changed to me less generic. (@singlexyz)
that pull request i mentioned was actually merged in. it switched out ueberzeug with "Chafa", which uses text symbols to draw pictures with extreme ascii art https://github.com/nvim-telescope/telescope-media-files.nvim/pull/35
Any update on macos support?
Überzug doesn't support MacOs, Then I found a Plugin: https://github.com/edluffy/hologram.nvim Maybe use its method to achieve image preview in Telescope.