You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, i installed the plugin and noticed that i got only errors when trying it out in nvim-tree.
After some digging through the nvim-tree docs, I noticed that the command get_node_at_cursor() was no longer present, however there was a command called get_node_under_cursor() which seemed to do the same thing.
I tested it out in my local keymaps file just to see if it would work, and it did, here is the example of what i tested:
nnoremap("<leader>P", function ()
localnvimtree=require("nvim-tree.api")
localimg_preview=require("image_preview")
localpath=nvimtree.tree.get_node_under_cursor().absolute_pathimg_preview.PreviewImage(path)
end, { desc="Preview image under cursor (NvimTree)" })
nnoremap is just a personal helper that sets up the keybind for normal mode btw.
So i think the plugin should work for nvim-tree again with just 2 changes, here is what i think the PreviewImageNvimTree function should look like instead:
function M.PreviewImageNvimTree()
- local use, imported = pcall(require, "nvim-tree.lib")+ local use, imported = pcall(require, "nvim-tree.api")
if use then
- local absolutePath = imported.get_node_at_cursor().absolute_path+ local absolutePath = imported.tree.get_node_under_cursor().absolute_path
M.PreviewImage(absolutePath)
else
return ''
end
end
I didn't have time to make a proper pull request, but if you ever get to it i hope this issue helps!
The text was updated successfully, but these errors were encountered:
I have tried your solution but the image still doesn't show in the terminal. Your fix did get the correct node, but it seems like the wezterm doesn't show image into buffer. I'm currently in macOS.
Edit: I am able to open image in Ubuntu, but still can't open in macOS using @MarGustafsson's solution.
Hi, i installed the plugin and noticed that i got only errors when trying it out in nvim-tree.
After some digging through the nvim-tree docs, I noticed that the command
get_node_at_cursor()
was no longer present, however there was a command calledget_node_under_cursor()
which seemed to do the same thing.I tested it out in my local keymaps file just to see if it would work, and it did, here is the example of what i tested:
nnoremap
is just a personal helper that sets up the keybind for normal mode btw.So i think the plugin should work for nvim-tree again with just 2 changes, here is what i think the
PreviewImageNvimTree
function should look like instead:I didn't have time to make a proper pull request, but if you ever get to it i hope this issue helps!
The text was updated successfully, but these errors were encountered: