Getting started
Introduction
yazi is a blazing fast terminal file manager written in Rust, using async I/O with a modern TUI interface.
Installation
# macOS
brew install yazi
# Arch Linux
pacman -S yazi
# Cargo
cargo install --locked yazi-fm yazi-cli
# From source
git clone https://github.com/sxyazi/yazi.git
cd yazi
cargo build --release
Quick start
yazi # Open in current directory
yazi /path/to/dir # Open specific directory
yazi file.txt # Open with file selected
Navigation
Basic movement
| Key | Action |
|---|---|
k / ↑ |
Move up |
j / ↓ |
Move down |
h / ← |
Go to parent directory |
l / → |
Enter directory / Open file |
Jump navigation
| Key | Action |
|---|---|
g g |
Jump to top |
G |
Jump to bottom |
[ |
Jump to previous sibling directory |
] |
Jump to next sibling directory |
Quick navigation
| Key | Action |
|---|---|
~ |
Go to home directory |
- |
Go to previous directory |
Space |
Toggle selection |
/ |
Search files |
z |
Jump using zoxide |
File operations
Basic operations
| Key | Action |
|---|---|
y |
Yank (copy) files |
x |
Cut files |
p |
Paste files |
d |
Trash files |
D |
Delete permanently ⚠️ |
a |
Create file/directory |
r |
Rename file |
Selection
| Key | Action |
|---|---|
Space |
Toggle selection |
v |
Enter visual mode |
V |
Enter visual mode (unset) |
Ctrl+a |
Select all |
Ctrl+r |
Inverse selection |
Esc |
Cancel selection |
Yank modes
| Key | Action |
|---|---|
y |
Yank selected files |
Ctrl+y |
Copy absolute path |
Alt+y |
Copy relative path |
Ctrl+Shift+y |
Copy dirname |
Viewing & previewing
Preview controls
| Key | Action |
|---|---|
T |
Toggle preview pane |
Ctrl+↑ |
Scroll preview up |
Ctrl+↓ |
Scroll preview down |
Ctrl+PageUp |
Page up in preview |
Ctrl+PageDown |
Page down in preview |
Opening files
| Key | Action |
|---|---|
Enter |
Open file with default app |
o |
Open interactively |
O |
Open in directory |
Ctrl+o |
Open with custom app |
View modes
# Preview supports:
- Text files (syntax highlighting)
- Images (kitty/iterm2 protocol)
- Videos (thumbnail)
- PDFs (thumbnail)
- Archives (file list)
- JSON/YAML (formatted)
Search & filter
Search
| Key | Action |
|---|---|
/ |
Search forward |
? |
Search backward |
n |
Next match |
N |
Previous match |
Esc |
Cancel search |
Filter
| Key | Action |
|---|---|
f |
Filter files |
Ctrl+f |
Smart filter |
Ctrl+s |
Filter by file type |
Tabs & panes
Tab management
| Key | Action |
|---|---|
t |
Create new tab |
1-9 |
Switch to tab N |
[ / ] |
Switch tab left/right |
{ / } |
Swap tab left/right |
w |
Close current tab |
Tasks
| Key | Action |
|---|---|
W |
Show task manager |
Ctrl+c |
Cancel current task |
Ctrl+z |
Suspend task |
Help & info
| Key | Action |
|---|---|
~ |
Show help |
Ctrl+h |
Show hidden files |
Ctrl+i |
Show file info |
Configuration
Config location
# Config directory
~/.config/yazi/
# Main config files
~/.config/yazi/yazi.toml # General settings
~/.config/yazi/keymap.toml # Keybindings
~/.config/yazi/theme.toml # Color theme
~/.config/yazi/init.lua # Lua initialization
Basic yazi.toml
[manager]
ratio = [1, 4, 3] # Miller column ratios
sort_by = "natural" # Sort method
sort_dir_first = true # Directories first
linemode = "size" # Show file size
show_hidden = false # Hide dotfiles
show_symlink = true # Show symlink targets
[preview]
max_width = 1000 # Max preview width
max_height = 900 # Max preview height
image_filter = "lanczos3" # Image scaling
image_quality = 90 # JPEG quality
Custom keybindings
# keymap.toml
[manager]
keymap = [
{ on = ["<C-n>"], exec = "arrow 5" }, # Move 5 down
{ on = ["<C-p>"], exec = "arrow -5" }, # Move 5 up
{ on = ["e"], exec = "shell '$EDITOR $@' --block" },
{ on = ["<C-g>"], exec = "plugin lazygit" },
]
[tasks]
keymap = [
{ on = ["<Esc>"], exec = "close" },
{ on = ["w"], exec = "close" },
]
Theme customization
# theme.toml
[manager]
cwd = { fg = "cyan", bold = true }
[filetype]
rules = [
{ mime = "image/*", fg = "yellow" },
{ mime = "video/*", fg = "magenta" },
{ mime = "audio/*", fg = "cyan" },
{ name = "*", fg = "white" },
{ name = "*/", fg = "blue", bold = true },
]
Plugins
Plugin system
-- ~/.config/yazi/init.lua
require("full-border"):setup()
require("git"):setup()
-- Custom plugin
local state = ya.sync(function()
return cx.active.current.cwd
end)
Installing plugins
# Clone plugin to yazi plugins directory
cd ~/.config/yazi
mkdir -p plugins
cd plugins
# Example: git integration
git clone https://github.com/yazi-rs/plugins/git.git
# Example: full border UI
git clone https://github.com/yazi-rs/plugins/full-border.git
Popular plugins
| Plugin | Description |
|---|---|
full-border |
Enhanced border UI |
git |
Git status integration |
jump |
Autojump/z integration |
fzf |
Fuzzy finder integration |
lazygit |
LazyGit integration |
Shell integration
Ya wrapper (change directory)
# ~/.zshrc or ~/.bashrc
function ya() {
local tmp="$(mktemp -t "yazi-cwd.XXXXX")"
yazi "$@" --cwd-file="$tmp"
if cwd="$(cat -- "$tmp")" && [ -n "$cwd" ] && [ "$cwd" != "$PWD" ]; then
cd -- "$cwd"
fi
rm -f -- "$tmp"
}
Fish shell
# ~/.config/fish/functions/ya.fish
function ya
set tmp (mktemp -t "yazi-cwd.XXXXX")
yazi $argv --cwd-file="$tmp"
if set cwd (cat -- "$tmp"); and [ -n "$cwd" ]; and [ "$cwd" != "$PWD" ]
cd -- "$cwd"
end
rm -f -- "$tmp"
end
Environment variables
# Set default editor for yazi
export EDITOR="nvim"
# Set default pager
export PAGER="less"
# Configure image protocol
export YAZI_IMAGE_PROTOCOL="kitty" # or "iterm2"
Advanced usage
Custom commands
# Execute shell command on selected files
:shell echo $@ --confirm
# Bulk rename with editor
:bulk-rename
# Create symbolic link
:link --relative
# Calculate directory size
:shell du -sh $@ --block
Opener configuration
# ~/.config/yazi/yazi.toml
[opener]
edit = [
{ exec = '$EDITOR "$@"', block = true },
]
open = [
{ exec = 'xdg-open "$@"', orphan = true },
]
image = [
{ exec = 'feh "$@"', orphan = true },
]
video = [
{ exec = 'mpv "$@"', orphan = true },
]
# File type associations
[[opener.rules]]
mime = "text/*"
use = "edit"
[[opener.rules]]
mime = "image/*"
use = "image"
[[opener.rules]]
mime = "video/*"
use = "video"
Archive preview
# yazi.toml - configure archive handling
[plugin]
prepend_previewers = [
{ mime = "application/zip", exec = "ouch" },
{ mime = "application/x-tar", exec = "ouch" },
{ mime = "application/x-rar", exec = "ouch" },
]
Sorting & filtering
Sort modes
| Key | Sort by |
|---|---|
s m |
Modified time |
s c |
Created time |
s e |
Extension |
s n |
Natural order |
s s |
Size |
s a |
Alphabetical |
s r |
Reverse order |
File filtering
# Filter by extension
.md$ # All markdown files
^\. # All hidden files
\.(jpg|png)$ # Images
# Filter by name pattern
^test_.* # Files starting with test_
.*_backup$ # Files ending with _backup
CLI usage
Command line options
# Open specific directory
yazi /path/to/dir
# Start with file selected
yazi --entry=/path/to/file
# Clear cache
yazi --clear-cache
# Write CWD on exit
yazi --cwd-file=/tmp/cwd
Ya CLI tool
# Send message to running yazi instance
ya send cd /tmp
# Publish to yazi subscribers
ya publish "custom-event"
# Get current state
ya state
Tips & tricks
Performance tips
# yazi.toml - optimize for large directories
[manager]
ratio = [1, 3, 2] # Smaller preview pane
max_preview = 5000 # Limit preview size
[preview]
max_width = 800
max_height = 600
cache_dir = "~/.cache/yazi" # Use cache
Batch operations
# Select multiple files
Space # Toggle selection
Ctrl+a # Select all
v # Visual mode
# Apply operation to all selected
y # Yank all
p # Paste all
d # Trash all
Integration examples
# Open with fzf selection
fzf | xargs yazi
# Integrate with ripgrep
rg -l "pattern" | xargs yazi
# Use with fd
fd --type f | xargs yazi --entry
Gotchas & warnings
Common issues
Preview not working
# Check image protocol support
echo $YAZI_IMAGE_PROTOCOL
# Install preview dependencies
brew install ffmpegthumbnailer # Video thumbnails
brew install poppler # PDF preview
brew install jq # JSON preview
Keybinding conflicts
# Disable default keybinding in keymap.toml
[manager]
keymap = [
{ on = ["j"], exec = "" }, # Disable 'j'
{ on = ["<C-j>"], exec = "arrow 1" }, # Remap
]
Important warnings
Dpermanently deletes (bypasses trash) ⚠️- Large directories may slow preview generation
- Image preview requires kitty/iterm2/sixel protocol
- Some plugins require Lua 5.4+
- Custom openers may block the UI (use
orphan = true)
Path handling
# yazi uses relative paths by default
# Use Ctrl+y for absolute paths
# Use Alt+y for relative paths
# When scripting, prefer absolute paths
cd "$(yazi --cwd-file=/tmp/yazi_cwd)"
Also see
- yazi GitHub Repository (github.com)
- yazi Documentation (yazi-rs.github.io)
- yazi Plugins (github.com)
- yazi Flavors (Themes) (github.com)
- Awesome yazi (github.com)