If you're using yazi as your terminal file manager and coming from vim/neovim, you've probably tried to quit with :q out of habit, only to be greeted with:

q: command not found

This happens because yazi's : key opens a shell command prompt, not a vim-style command mode. So :q literally tries to execute q as a shell command.

The Solution#

I wanted to keep both functionalities:

  • Vim-style :q to quit
  • Shell command access for running commands like touch file

Here's how I solved it by customizing ~/.config/yazi/keymap.toml:

# Remap ; to blocking interactive shell (what : used to do)
[[manager.prepend_keymap]]
on = [ ";" ]
run = "shell --interactive --block"
desc = "Shell (block)"

# Now use : for vim-style commands
[[manager.prepend_keymap]]
on = [ ":", "q" ]
run = "quit"
desc = "Quit (vim-style)"

How It Works#

  • ; now opens the interactive shell prompt with blocking mode (so you see command output)
  • :q quits yazi, just like in vim
  • Other commands like :touch file still work through the ; key

The key insight is using yazi's shell --interactive --block command, which provides the same functionality as the original : binding.

Bonus: Non-blocking Shell Commands#

You might wonder why I kept the --block flag. In a file manager context, you almost always want to see the output of your commands or wait for them to complete. Non-blocking shell commands are rarely useful here, so I ditched that complexity entirely.

Now my muscle memory is happy, and I can still access all the shell functionality I need! Enjoy!