Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug in opening yazi instead of netrw for directories #55

Closed
tkivela opened this issue Apr 26, 2024 · 6 comments · Fixed by #57
Closed

Bug in opening yazi instead of netrw for directories #55

tkivela opened this issue Apr 26, 2024 · 6 comments · Fixed by #57
Assignees

Comments

@tkivela
Copy link

tkivela commented Apr 26, 2024

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 ./fooif 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?

@mikavilpas
Copy link
Owner

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 🙂

@mikavilpas mikavilpas self-assigned this Apr 26, 2024
@tkivela
Copy link
Author

tkivela commented Apr 26, 2024

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

@tkivela
Copy link
Author

tkivela commented Apr 26, 2024

oil.nvim (another Neovim file explorer) has option default_file_explorer too if you want another reference implementation https://github.com/stevearc/oil.nvim.

@mikavilpas
Copy link
Owner

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?

@mikavilpas mikavilpas reopened this Apr 26, 2024
@tkivela
Copy link
Author

tkivela commented Apr 26, 2024

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.

@mikavilpas
Copy link
Owner

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants