Bug in opening yazi instead of netrw for directories
tkivela opened this issue · comments
I'm having problems replacing netrw with yazi with open_for_directories = true
.
I tested multiple ways of setting it up, including you own config file (https://github.com/mikavilpas/dotfiles/blob/bfe476175025a9b7ca035348274b065b5233d46a/.config/nvim/lua/plugins/my-file-manager.lua), but when i open neovim from command line (for example nvim ./foo
if I have a folder foo
) it opens up netrw instead of yazi.nvim.
Could you help with the setup or is there a bug in the open_for_directories
?
Hi! I think there is a limitation in the implementation as I get this behaviour too. 🤔
I also (rarely) use https://github.com/nvim-neo-tree/neo-tree.nvim when showing things to colleagues over screen sharing. It doesn't seem to have this limitation.
I'll see how they avoided this and whether I can copycat whatever they have done 🙂
When calling setup manually as advised in readme it doesn't seem to replace netrw either, example here https://github.com/gldtn/dotfiles/blob/6df66ab32f6fe331d42705e886b1de9dd7644ead/.config/nvim/lua/plugins/yazi.lua
oil.nvim (another Neovim file explorer) has option default_file_explorer
too if you want another reference implementation https://github.com/stevearc/oil.nvim.
Thanks for the link! Oil.nvim looks a bit more complicated but I think the idea is the same:
- when running
setup()
,- if a directory is currently open
- and the user wants to replace netrw,
- display the new ui instead
I implemented the same algorithm, but I'm not sure if I have replaced the netrw ui right now. Can you get the newest version and try it out?
It seems to open up yazi now for directories if I disable lazy loading for the plugin (lazy = false
) but there seems to be some kind of focusing problem to the yazi window/modal: I cannot move in the yazi window at all, the cursor is located at the [No Name] buffer which is behind the yazi modal.
if I disable lazy loading
That is correct - I don't think lazy loading can be used because the setup
function needs to run before opening a directory.
The focus issue has been a problem for a while with no good fix. If you have any ideas, I would gladly hear them!