Yazi: Fast terminal file manager based on async I/O
github.com
github.com
If you're interested in the topics of concurrency, performance, and io_uring discussed in this thread, you can take a look at my new article where I provide a detailed explanation of "Why is Yazi Fast?"
One thing if I may: I can't figure out how to use it. Like: The bottom right says "1 remaining", but I don't know what that is. I can't figure out how to run `rg` or `fd` from within Yazi.
Is there a user manual or a tutorial somewhere to read?
You can press `?` or `~` to open the help panel, which contains all supported keybindings.
I took a long look at the "docs" but I did not find them helpful at all [1]
Even figuring out that you can press `?` to open the help panel took me way to long to figure out because it is not referenced in any obvious way.
I would be more than willing to stand on the user's side and continually improve the docs. If you would be interested in creating a quick guide for Yazi that would be great if it's possible :)
It's super simple to read (once I found the setting to display tabs as 4 chars in GitHub), well organized, and has some neat patterns that seem to work well for building out TUI apps. Come say hi in the Ratatui discord sometime.
My main issue I couldn't find a way to filter the list of files/directories for the current directory I'm in. Let's say I want to go to directory `cpp`, and it's 22 entries down the list of current files/folders. If I try to `fd` for `cpp`, I'm going to get back a ton of results from all over my hard drive. So it seems like I need to just scroll way down, which is a bummer. In nnn, you can just type `/` then `cpp` and it will filter results in CWD that match.
A nice-to-have would be live fuzzy-find functionality for the fd/rg integration, but that is not so critical.
The other thing I like about nnn is it retains `g` and `G` from vim to go to the top and bottom of the list of results respectively. I didn't see a similar operation in yazi.
Otherwise, very awesome tool, the performance is excellent, I appreciate how you explicitly state the external shell programs you interface with, I love the built in previews, and the devicons look clean.
In fact, `G` and `gg` are already supported in Yazi. You just need to set `arrow -999` for `gg`, and `arrow 999` for `G`. I've added it to the default keybindings: https://github.com/sxyazi/yazi/commit/c540542da49004a3084b1d...
The enhanced find/filter feature has been noted in the Feature Requests (https://github.com/sxyazi/yazi/issues/51), and I will make an effort to implement it soon. Of course, PRs welcome if possible :)
I am not sure I am a fan of this, because I don't actually need everything to start being rendered. Maybe rendering something when I press a specific button would be good enough and that wouldn't necessarily require async stuff.
Why do we so readily convince ourselves against doing the right thing, picking good technology? "Over engineering" is a huge massive bat of a word that is applied to "correct" all kinds of spirited ambition.
Fear Uncertainty & Doubt is a dangerous default mode to adapt. I do not feel that it should be such an ordeal, require such courage, to do the good & right things. Better to try & fail than risk whiling ones time on lukewarm efforts.
What is the actual danger here? What are you afraid of? Why hold your biases against another's endeavor?
Doing previews in a non-blocking way sounds really cool though, I'm not ragging on the concept, just saying I am mistrustful of async.
For an application like yazi async is likely a much more pleasurable experience to write code in than trying to manage threads and cancellations by hand.
# Rename this file to match the name of the function
# e.g. ~/.config/fish/functions/ya.fish
# or, add the lines to the 'config.fish' file.
function ya
set tmp (mktemp -t "yazi-cwd.XXXXX")
yazi --cwd-file="$tmp"
if set cwd (cat -- "$tmp") && [ -n "$cwd" ] && [ "$cwd" != "$PWD" ]
cd -- "$cwd"
end
rm -f -- "$tmp"
end"async Io" doesn't mean a ton to me, other than hopefully not blocking. It'd be cool to have a great well integrated terminal file manager that uses high performance io_uring.
That said, I have a hard time figuring out when & where I'd want to use terminal file managers. I like the idea, but the flexibility of the shell is so unparalleled.
Are there know ways that io_uring would leak through such an abstraction?
It says "CPU tasks are spread across multiple threads", but what CPU tasks does a file manager perform?
io_uring is for use cases where the context switch overhead of system calls starts to matter. While async I/O can be justified for U/I programming, it's safe to say that a file manager won't ever benefit from io_uring.
> There are many scenarios that require CPU, such as image downscaling, image encoding, code highlighting, sorting large directories, etc.
If you want to delve further into Yazi's inner workings, you can see https://github.com/sxyazi/yazi/issues/143
Unless you have millions of CPU cores and therefore many downscaling/encoding/highlighting tasks starting/finishing every second, I still don't see what io_uring brings to the table.
Running tasks in the background does NOT require io_uring.
I don't use it for everything and I still copy/move files a lot without it. But it accelerates some things and is simple to use.
This is something we can consider for our future work, as it's not the current performance bottleneck.
For more details: https://github.com/sxyazi/yazi/issues/143
In 2023 I still need two extra terminals for vim and for bash. And text selection is mouse-only.
Terminal multiplexers like tmux, GNU screen, and others allow for keyboard-based text selection and copy / paste.
Many advanced editors like VS Code, Emacs, and other have built-in terminals and keyboard commands to select, copy, and paste text.
> In 2023 I still need two extra terminals for vim and for bash.
wat
On the console, many use cases where you'd need copy&paste can be covered by autocompleters. For example branch names in version control. Someday I'll have to look into how to write my own...
Edit: with !, you can execute a shell command and watch its output without leaving Vim.