mikavilpas / yazi.nvim

A Neovim Plugin for the yazi terminal file manager

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Investigate using toggleterm.nvim for toggleable, persisted yazi sessions

mikavilpas opened this issue · comments

Currently, yazi is displayed in a floating terminal. The terminal can be opened, and after it's closed the entire yazi session is gone forever.

Although it's very fast to start a new session, this is too disruptive for the following use cases:

  1. yazi is displayed over something important, and I want to see the thing that's hidden, and then return back to the yazi session
  2. the bulk renaming feature provided by yazi cannot work because it needs to continue the yazi session (this is also tracked in #135)

I think it should be possible to hide yazi without closing it, and then reshow it.

If anyone has experience with toggleterm.nvim, I would really welcome any ideas! I haven't used it myself so I think I might be missing something obvious

https://github.com/akinsho/toggleterm.nvim?tab=readme-ov-file

the bulk renaming feature provided by yazi cannot work because it needs to continue the yazi session

I think it's because Yazi starts with yazi --local-events > /tmp/xxx, which doesn't affect Yazi's own TUI rendering since Yazi's TUI happens in stderr. But when Yazi invokes nvim for renaming, nvim's TUI renders in stdout, which means all TUI output gets redirected to /tmp/xxx, making it invisible.

This issue would not only affect nvim but any interactive program launched within Yazi. Do you think it's feasible to abandon --local-events and make the new command ya sub work instead?

That's a great idea. I think this is definitely the way we should go.

Note to myself:

Displaying a long running yazi process will need #152 which provides support for ya to read events continuously instead of at the end of the yazi session as is currently done.

update: ya is now used to read events. Some events are read "live", meaning that they can be handled while the floating window is open. Other events need to be handled after the floating window has closed.

An interesting example are delete events. When they are received (which means the user deleted a file in yazi, and the file was also open in a window behind the floating window), yazi.nvim should close the buffer for the file that was deleted.

In some cases it's not possible to do this. It seems if the file is the only visible window, neovim fails to delete the buffer silently. This can be tracked in neovim/neovim#20315

This issue is stale because it has been open for 30 days with no activity.

This issue was closed because it has been inactive for 14 days since being marked as stale.