Open oblitzitate opened 1 month ago
sounds interesting, I'll give it a try, thanks for the suggestion
You can see it now on v0.8 (not documented yet)
you can add this to your config:
require("simplyfile").setup {
grid_mode = {
enabled = true,
get_icon = function(dir)
if require("simplyfile.util").matches(dir.name, {
"%.png$", "%.jpe?g$", "%.avif$", "%.gif$", "%.webp$",
"%.svg$",
}) then
return dir.absolute
end
if dir.is_folder then
return "/path/to/folder_icon.png"
else
return "/path/to/file_icon.png"
end
end
},
}
but rendering many image on my laptop is slow so i made the icon can be a text (the default setting if the get_icon
not setted):
require("simplyfile").setup {
grid_mode = {
enabled = true,
},
}
You'll probably need to implement asynchronous rendering (as well as caching) to reduce the slowness.
But anyways, it's nice you worked on it pretty quickly. Unfortunately, mine looks like the following:
...while using the following config in Xorg ArchLinux:
require("simplyfile").setup {
grid_mode = {
enabled = true,
},
}
Edit: I found out the visual bug occurs when the wrap
option is set to true
Thanks for the report.
You'll probably need to implement asynchronous rendering (as well as caching) to reduce the slowness.
Yes, for optimization, I will implement it.
The buffer looks like that because i forgot to delete times 3 on this line: https://github.com/Rizwanelansyah/simplyfile.nvim/blob/099b8b4b5eb939243b175bc90ac4458ea40a5751/lua/simplyfile/grid_mode.lua#L46
Each row is multiplied by 3, so if wrap is turned on the spaces that should extend to the right will be wrapped downwards
Nice.
I also propose that it should have a mode called auto
that applies the grid view per directory based on a condition, otherwise it applies the normal view for readability. The default condition could be that the directory must contain multiple (at least 2) media files that are known to have thumbnails. I suppose it could be just image files for now. If you know of a better default condition, feel free to use it instead.
require("simplyfile").setup {
grid_view = {
mode = "auto", -- "on", "off", or "auto"
condition = function(dir) -- Applies when the mode is "auto"
-- Detect multiple media files
end,
get_icon = function(dir)
-- ...
end,
},
}
or what about mode
can be a string or table, if the mode
is string set it for all windows, if it's a table set it for each window, in case some people like the grid mode on the main window only.
require("simplyfile").setup {
grid_view = {
-- "on" | "off" | "auto" for all windows
-- mode = "auto",
mode = {
left = "off",
main = "on",
right = "off",
},
},
}
I personally wouldn't add the per-window settings, unless you plan to use it yourself or someone asks for it with a good case as to why. It just doesn't seem like good user experience. When I'm trying to look at a directory, I'd like it to remain one type of view (depending on if it has multiple media files or not). It would make navigating annoying if the directory is changing views depending on the window it's in.
If I wanted to see both types of views of a directory, I would rather use a toggle view button than having to annoyingly navigate forward/back just to make the directory appear at a certain window with a different type of view.
Also, with regards to the slow rendering, the image size may also be a factor, especially if it's large. You may have to create and cache thumbnails like what GUI file managers do, so that the images are smaller and load faster.
I personally wouldn't add the per-window settings, unless you plan to use it yourself or someone asks for it with a good > case as to why. It just doesn't seem like good user experience. When I'm trying to look at a directory, I'd like it to remain > one type of view (depending on if it has multiple media files or not). It would make navigating annoying if the directory is > changing views depending on the window it's in.
Yeah maybe it's not a good idea.
But i have finished the auto
mode, you can see it in this video.
Just saw you integrated image.nvim so I figured it would be cool to have a grid view w/ thumbnails in order to be able to quickly glance through media files that have thumbnails (e.g. images, videos, music with embedded art, books, etc.)
I have yet to see a terminal file explorer implement such a feature so this would definitely help differentiate your file explorer from the rest.