Closed sedlund closed 1 month ago
Yazi uses file -bL
to preview any files that don't match a preview rule:
If we want to support /proc
, this means we would need to detect this type of file in the file.lua
previewer:
But I'm not sure if there's any way to do that. Any ideas?
maybe implement some logic about the filesystem type its browsing would be good.
if its proc it could just display the text of filenames without extensions (ie: not /proc/config.gz
).
this would also solve another issue i have on rclone mount
filesystems (type: fuse.rclone
) where yazi tries to run file
on huge buckets of images to get mimetypes causing huge amount of network io.
maybe implement some logic about the filesystem type its browsing would be good.
I'm not sure I understand you correctly - do you mean that /proc
is mounted on a different filesystem?
if its proc it could just display the text of filenames without extensions (ie: not /proc/config.gz).
Are you saying to use the filename as the preview content on the right pane?
do you mean that /proc is mounted on a different filesystem?
it is a virtual filesystem of type proc
in Linux to access configuration of the kernel.
> grep proc /proc/mounts
proc /proc proc rw,nosuid,nodev,noexec,noatime 0 0
Are you saying to use the filename as the preview content on the right pane?
Sorry, no. In /proc
regular files of 0 size without extensions are virtual hooks into kernel paramaters - the content of the file can just be output to the right pane. I don't know if this is the exact specification. But /proc/config.gz
is a gzipped virtual file (binary with a size of 25K on my current system) of the configuration that the running kernel was compiled with - which should not be previewed in the right pane (unless it could be decompressed, which would be nice).
Does this mean that all Unix-like systems have a /proc
directory, and if we need to get mount info through /proc/mounts
first, it is guaranteed to be present?
I noticed that there are some directories in /proc
, and some files in these directories seem to contain binary content. Is there a way to detect this, for example cat /proc/bus/pci/0000:00/00.0
?
Does this mean that all Unix-like systems have a /proc directory most do (*bsd, solaris, aix, hpux) I read that macos has a
/dev/proc
if we need to get mount info through /proc/mounts first, it is guaranteed to be present?
on linux the mount
command reads /proc/mounts
and formats that output. /proc will be present and is utilized by many *nix tools. macos has a mount
command as well, i don't know how it reads its mounts from the kernel.
maybe there is an OS independent rust crate that does all this.
some files in these directories seem to contain binary content. Is there a way to detect this, for example cat /proc/bus/pci/0000:00/00.0
I see. those files have size > 0. the 'lf' file browser shows them as binary.
maybe if it's a regular file and 0 size, just cat it, if it has size, run file on it.
It looks like macOS doesn't implement /proc
https://superuser.com/questions/631693/where-is-the-proc-folder-on-mac-os-x. I'll create a PR later to implement it just for Linux.
Please try https://github.com/sxyazi/yazi/pull/1482
works great! Thanks!
I'm going to lock this issue because it has been closed for 30 days. ⏳ This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.
yazi --debug
outputPlease describe the problem you're trying to solve
when browsin /proc I'd like to be able to preview the contents of the virtual files. currently yazi shows them as empty
for example lf displays their content in preview.
Would you be willing to contribute this feature?
Describe the solution you'd like
id like to see the contents of the file
Additional context
No response
Validations