← Back to articles

Configure Yazi to Open Files in Neovim

Path: Computer Tech/Terminal/Yazi/Configure Yazi to Open Files in Neovim.mdUpdated: 2/3/2026

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):

bash
export EDITOR="nvim"
export VISUAL="nvim"

Then reload your shell:

bash
exec zsh

This affects all terminal applications, not just Yazi.

Method 2: Configure Yazi Directly

Create Yazi config directory and opener file:

bash
mkdir -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

  1. Open Yazi: yazi
  2. Navigate to a text file
  3. Press Enter to open
  4. 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:

  1. Check your $EDITOR variable: echo $EDITOR
  2. Verify nvim is in PATH: which nvim
  3. Restart terminal/reload shell config

Files open but exit immediately:

  • Add block = true to yazi.toml opener config (shown above)
  • This tells Yazi to wait for nvim to exit before returning

Related Keybindings

KeyFunction
EnterOpen file in configured editor
eCustom keybind (if configured) to open in nvim
oOpen with system default application
OOpen interactively (choose application)

Links

Yazi Configuration Docs

Yazi Keymap Documentation