dotfiles icon indicating copy to clipboard operation
dotfiles copied to clipboard

[BUG] Opening files via Yazi does not respect default EDITOR

Open malhashemi opened this issue 8 months ago • 3 comments

Describe the bug

The current setup

  • Yazi as the default file explorer
  • Kitty as the default terminal
  • nvim as the default EDITOR

Details

Running Yazi through the terminal correctly opens the files using nvim. However using Yazi via the explorer keybinding opens files using nano.

Steps to reproduce

Reproduce

  1. Call the file explorer yazi via the keybinding
  2. navigate to any file and press o
  3. Take note that nano is used

Verify correct editor

  1. open kitty via the default keybinding
  2. type yazi
  3. Navigate to any file and press o.
  4. Take note that nvim is used

Expected behavior

  1. Call the file explorer yazi via the keybinding
  2. navigate to any file and press o
  3. Take note that nvim is used

Screenshots

No response

Distribution

EndeavourOS

If Other, specify

No response

Additional context

No response

Code of Conduct

  • [x] I agree to follow this project's Code of Conduct

malhashemi avatar May 05 '25 08:05 malhashemi

@malhashemi Can you enter

export EDITOR=nvim

into a terminal and try again?

mylinuxforwork avatar May 06 '25 09:05 mylinuxforwork

That didn't work but I have been doing some testing on what could be the issue. I think it is in the way 'exec' works in Hyprland. So when running the same script that key binding executes using any terminal I get yazi to use nvim, but everytime I press the keybinding yazi still uses nano. So I tried exporting the editor to NVIM from TTY. Did that by pressing Ctrl+Alt+F3 on the SDDM logging screen and that fixed the issue. However that is not persistent and every time I reboot I have to do the same thing. Appreciate if you have a better solution here

malhashemi avatar May 06 '25 10:05 malhashemi

That didn't work but I have been doing some testing on what could be the issue. I think it is in the way 'exec' works in Hyprland. So when running the same script that key binding executes using any terminal I get yazi to use nvim, but everytime I press the keybinding yazi still uses nano. So I tried exporting the editor to NVIM from TTY. Did that by pressing Ctrl+Alt+F3 on the SDDM logging screen and that fixed the issue. However that is not persistent and every time I reboot I have to do the same thing. Appreciate if you have a better solution here

Configure openers in ~/.config/yazi/yazi.toml

[opener]
play = [
	{ run = 'mpv "$@"', orphan = true, for = "unix" },
]
edit = [
	{ run = 'nvim "$@"', block = true, for = "unix" },
]
open = [
	{ run = 'xdg-open "$@"', desc = "Open" },
]

xonorhc avatar May 07 '25 00:05 xonorhc