Closed Daydreamer-riri closed 3 months ago
Hello! I don't use windows myself unfortunately, but it looks like the healthcheck fails to run because the following command fails:
:=vim.fn.system("yazi --version")
I bet to fix the issue, that command should succeed. It probably indicates something is wrong with your neovim setup on windows.
The same error message seems to appear here, maybe something like this can help you https://github.com/neovim/neovim/issues/13893
Thank you very much for your prompt reply! Indeed, that's the reason. I simply set the shell without making the relevant settings. Thank you!
Hi @mikavilpas, sorry to bother you again. I tried to switch to using yazi.nvim in nushell and got this error:
Error: nu::shell::file_not_found
× File not found
╭─[source:1:1]
1 │ nu
· ▲
· ╰── Could not access file '/s': 系统找不到指定的文件。 (os error 2)
╰────
[Process exited 1]
Hmm, I have received reports from nushell users saying the plugin does work. Maybe you have to enable these for now (ref. https://github.com/mikavilpas/yazi.nvim/issues/130#issuecomment-2241063898)
-- enable these if you are using the latest version of yazi
-- use_ya_for_events_reading = true,
-- use_yazi_client_id_flag = true,
See the readme for where you should put these: https://github.com/mikavilpas/yazi.nvim?tab=readme-ov-file#using-lazynvim
I will make these the default option in some time, but for now you need to enable them manually.
I have enabled it. You can see my configuration here: nushell: https://github.com/Daydreamer-riri/LazyVimConfig/blob/main/lua/config/options.lua#L6-L14 yazi: https://github.com/Daydreamer-riri/LazyVimConfig/blob/main/lua/plugins/yazi.lua#L32-L33
Perhaps there is an issue with calling nushell through the neovim API on Windows. When I execute:
:=vim.fn.system("")
I get the same error.
https://github.com/neovim/neovim/issues/19648#issuecomment-1212295560 When I made the changes according to the instructions here, I got a different error:
Error: × Invalid literal
╭─[source:1:9]
1 │ yazi "D:\Users\ding.zhao\workspace\rn_dingzhi" --local-events "rename,delete,trash,move,cd" --chooser-file "D:\Users\DING~1.ZHA\AppData\Local\Temp\nvim.0\M3x4bW\0" > "D:\Users\DING~1.
ZHA\AppData\Local\Temp\nvim.0\M3x4bW\1"
· ───────────────────┬──────────────────
· ╰── unrecognized escape after '\' in string
╰────
[Process exited 1]
Hmm to be honest I have no idea what could be wrong with your setup. I'm not familiar with how neovim works on windows at all.
Does the same command work for you without neovim? Maybe neovim thinks it should use \
characters as file separators since you are on windows, but they are not understood by nushell...
It seems this is an issue upstream. The same command works normally in PowerShell. Thank you for your reply! Apologies for taking up your time.
Hi @mikavilpas, I dug into this again (since I use nushell more frequently and have to wait almost a second to open yazi.nvim in powershell, I wanted to try nushell), and I found out that the reason yazi.nvim is not available in nushell is this: https://github.com/ nushell/nushell/issues/8174, i.e. “backslash in double quotes” in “path\to\file” is treated as an escape character. Is there any way to fix this?
Hmm I'm not sure what the problem could be. If I try to replicate the issue with e reproduction setup described here (on osx) using the following command, I have no trouble opening yazi and then opening a file.
SHELL=nu nvim -u repro.lua
Can you try and see if you have the same behaviour?
OSX work fine because it's dir separator is ’/’, but windows's dir separator is ’\’. So you can see that error from my previous reply.
https://github.com/neovim/neovim/issues/19648#issuecomment-1212295560 When I made the changes according to the instructions here, I got a different error:
Error: × Invalid literal ╭─[source:1:9] 1 │ yazi "D:\Users\ding.zhao\workspace\rn_dingzhi" --local-events "rename,delete,trash,move,cd" --chooser-file "D:\Users\DING~1.ZHA\AppData\Local\Temp\nvim.0\M3x4bW\0" > "D:\Users\DING~1. ZHA\AppData\Local\Temp\nvim.0\M3x4bW\1" · ───────────────────┬────────────────── · ╰── unrecognized escape after '\' in string ╰──── [Process exited 1]
The command executed by this plugin is a path wrapped through double quotes, and the separator of the path is a backslash, which is considered an escape character.
In addition, if the backslash is replaced with a forward slash, the command here can be executed normally. This may be because YAZI automatically handles the path separators of different systems.
I can't test it yet because my personal computer is arm windows and can't install nvim. Next week I will try to change YAZI.nvim locally on my work computer to see if it works properly.
I suspect it might be related to neovim somehow. It might also be that in this plugin, the library plenary.nvim is used that might not support nushell like paths yet.
https://github.com/mikavilpas/yazi.nvim/blob/main/lua%2Fyazi%2Fprocess%2Fya_process.lua#L58-L58
I see this function: shellescape, according to the documentation I set shellslash to true
, and then yazi.nvim can be opened normally in nushell. I'm not sure if there will be other questions, and I'll report it if there is.
Thank you for always following this issue!
Wow that's really resourceful. Did not know such a setting exists, but glad it works!
Hi @mikavilpas, this setting I use breaks some other plugins. I ended up making this modification:
Do you mind if I submit a PR for running yazi.nvim in windows nushell to have this behavior? Maybe as a configuration item, I'm not sure what form this should take.
If you don't think this is appropriate, I can keep it in my personal fork.
Hmm I'm glad it worked for you. I suspect something is not right in Neovim itself possibly, as I have seen neo-tree also has pretty complicated logic for escaping paths.
Let's keep it on your form for now. I think this will never change, but if this starts to come up more I can maybe add a configuration option for it in the future.
Hmm I'm glad it worked for you. I suspect something is not right in Neovim itself possibly, as I have seen neo-tree also has pretty complicated logic for escaping paths.
Let's keep it on your form for now. I think this will never change, but if this starts to come up more I can maybe add a configuration option for it in the future.
Sure, thanks for your work!
https://github.com/mikavilpas/yazi.nvim/blob/main/lua%2Fyazi%2Fprocess%2Fya_process.lua#L58-L58
I see this function: shellescape, according to the documentation I set shellslash to
true
, and then yazi.nvim can be opened normally in nushell. I'm not sure if there will be other questions, and I'll report it if there is.Thank you for always following this issue!
hi, have you found a solution? I encountered the same problem when using rustacenvim ( a rust plugin). Even setting shellslash to true, it still did not work.
Hi @shouyierban, As I said earlier, I created a fork, made changes, and utilized bots to periodically update the upstream code.
Hi @shouyierban, As I said earlier, I created a fork, made changes, and utilized bots to periodically update the upstream code.
thank you for your reply, I will try too..
Thank you for your great work! I encountered some issues while trying to use it. It does not work properly on Windows.