I’ve been using Midnight Commander for years and I still enjoy it pretty much. The first time I’ve seen a file manager using the multi-column layout was on NeXTSTEP operating system. It was pretty smart, I felt in love with this operating system. When I first used yazi it reminded me of the early days of this OS who hasn’t been around long enough for my taste. So let me introduce you to yazi, a terminal based multi-column file manager written in Rust.
cheatsheet
Let me start by the most important shortcuts for day to day use.
General
shortcuts | description |
---|---|
~ |
help |
t |
create a tab |
1..2..3..n |
switch to tab |
ctrl + c |
close tab |
T |
toggle preview zoom (plugin) |
[ ] |
switch to previous, next tab |
q |
quit |
File Operations
shortcuts | description |
---|---|
. |
toggle hidden files |
z Z |
using zoxide or fzf to jump to a directory |
y Y |
copy selected files, cancel |
x X |
cut selected files, cancel |
p P |
paste selected files, overwrite if exist |
d D |
trash, permanently delete |
r |
rename |
f |
filter |
/ ? |
find next, previous |
n N |
go to next, previous |
s S |
search by name or content |
, s |
sort by size and show size |
, |
access all sorts capabilities |
a |
create a file add a trailing / to create a dir |
Navigation & Selection
shortcuts |
description |
---|---|
g |
go menu |
gg |
move to the bottom |
G |
move to the top |
space |
toggle selection |
esc |
cancel selection |
ctrl + a |
select all files |
ctrl + r |
reverse selection |
v V |
visual more on, off |
You can tweak all of the above hotkeys.
Installation
On macOS
brew install yazi fzf zoxide glow
On Arch Linux
sudo pacman -S yazi ffmpeg p7zip jq poppler fd ripgrep fzf zoxide imagemagick glow
You can also install the latest version from source
yay -S yazi-git
To quit it and stay in the current directory, add the following lines to your ~/.zshrc
#Yazi - allows to keep dir location when existing with q otherwise use Q
function y() {
local tmp="$(mktemp -t "yazi-cwd.XXXXXX")" cwd
yazi "$@" --cwd-file="$tmp"
if cwd="$(command cat -- "$tmp")" && [ -n "$cwd" ] && [ "$cwd" != "$PWD" ]; then
builtin cd -- "$cwd"
fi
rm -f -- "$tmp"
}
Now to integrate with fzf and zoxide you can also add
#fzf - Set up fzf key bindings and fuzzy completion
source <(fzf --zsh)
#zoxide - better cd
eval "$(zoxide init zsh)"
After source ~/.zshrc
you can launch it.
y
Plugins
One of the beauty of yazi is his ability to be extended with plugins. In my case I’ve installed the following ones
# to add border
ya pack -a yazi-rs/plugins:full-border
# to show git status
ya pack -a yazi-rs/plugins:git
# allow to zoom into preview with T
ya pack -a yazi-rs/plugins:max-preview
# required to preview Markdown files
ya pack -a Reledia/glow
Once installed you have to tweak your configuration files
# enable borders and git plugins
vi ~/.config/yazi/init.lua
require("full-border"):setup()
require("git"):setup()
# keymap configuration for max-preview
vi ~/.config/yazi/keymap.toml
[[manager.prepend_keymap]]
on = "T"
run = "plugin max-preview"
desc = "Maximize or restore preview"
# general configuration for git and md previewing
vi ~/.config/yazi/yazi.toml
[[plugin.prepend_fetchers]]
id = "git"
name = "*"
run = "git"
[plugin]
prepend_previewers = [
{ name = "*.md", run = "glow" },
]
You’re almost done. If you are running yazi on macOS you can configure it to launch the native quickview by adding in your keymap.toml
[[manager.prepend_keymap]]
on = "<C-p>"
run = '''
shell 'qlmanage -p "$@"'
'''
Enjoy yazi.
What’s missing
When comparing with Midnight Commander the most important missing feature for me, is the ability to connect to remove machines to easily swap files. It seems it’s in the roadmap of yazi, so hopefully I may replace MC on most of my use cases. But I think I’ll still use it on my NAS, MC works better there because of less dependencies required.