mikavilpas / yazi.nvim

A Neovim Plugin for the yazi terminal file manager
MIT License
463 stars 16 forks source link

Investigate using toggleterm.nvim for toggleable, persisted yazi sessions #137

Closed mikavilpas closed 3 weeks ago

mikavilpas commented 3 months ago

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.

mikavilpas commented 3 months ago

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

sxyazi commented 3 months ago

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?

mikavilpas commented 3 months ago

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

mikavilpas commented 2 months ago

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.

mikavilpas commented 2 months ago

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 https://github.com/neovim/neovim/issues/20315

github-actions[bot] commented 1 month ago

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

github-actions[bot] commented 3 weeks ago

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