Configure Yazi to Open Files in Neovim
Configure Yazi to Open Files in Neovim
By default, Yazi opens files in $EDITOR or falls back to vim. To use Neovim (nvim) instead, configure Yazi's opener settings.
Method 1: Set Environment Variable (Recommended)
Add to your shell config (~/.zshrc):
bashexport EDITOR="nvim" export VISUAL="nvim"
Then reload your shell:
bashexec zsh
This affects all terminal applications, not just Yazi.
Method 2: Configure Yazi Directly
Create Yazi config directory and opener file:
bashmkdir -p ~/.config/yazi
Create ~/.config/yazi/yazi.toml:
toml[opener] edit = [ { run = 'nvim "$@"', block = true, for = "unix" }, ]
This tells Yazi to use nvim for editing files.
Verify Configuration
- Open Yazi:
yazi - Navigate to a text file
- Press
Enterto open - Should open in Neovim (not vim)
Alternative: Open with Custom Key
To keep default behavior but add a Neovim shortcut, create ~/.config/yazi/keymap.toml:
toml<span class="wikilink-broken" title="Page not found: manager.prepend_keymap">manager.prepend_keymap</span> on = [ "e" ] run = 'shell "nvim $@" --block --confirm' desc = "Edit with Neovim"
Now pressing e on any file opens it in Neovim.
Troubleshooting
Yazi still opens vim:
- Check your
$EDITORvariable:echo $EDITOR - Verify nvim is in PATH:
which nvim - Restart terminal/reload shell config
Files open but exit immediately:
- Add
block = trueto yazi.toml opener config (shown above) - This tells Yazi to wait for nvim to exit before returning
Related Keybindings
| Key | Function |
|---|---|
Enter | Open file in configured editor |
e | Custom keybind (if configured) to open in nvim |
o | Open with system default application |
O | Open interactively (choose application) |
Links
Yazi Configuration Docs
- URL: https://yazi-rs.github.io/docs/configuration/yazi
- Summary: Official documentation for yazi.toml configuration options
- Related: Yazi File Manager Navigation, Neovim, Unix
Yazi Keymap Documentation
- URL: https://yazi-rs.github.io/docs/configuration/keymap
- Summary: Guide to customizing Yazi keybindings
- Related: Yazi File Manager Navigation