neo-tree.nvim
neo-tree.nvim copied to clipboard
slash in windows makes invalid path
Discussed in https://github.com/nvim-neo-tree/neo-tree.nvim/discussions/1103
Originally posted by hf-xz August 16, 2023
What am i using
- Windows 11
- git-bash
- lazyvim
What i met
a. when i use <leader> e, which means Explorer NeoTree (root dir), it comes out with no item.
b. when i use <leader> E, which means Explorer NeoTree (cwd), it works normally.
What i found
- in case A, the path show on top of the explorer is
D:/Develop/back-end, linux slash style, this doesn't work. - in case B, the path is
D:\Develop\back-end, windows slash style, this work!
What i want
could there be any method to set the slash style? or some other way to solve the problem?
Tagging @hf-xz as this was originally their issue
@hf-xz, could you please post an example screenshot of a known failing filesystem structure so I can recreate it for testing/recreation purposes? Given that you said you are using lazyvim, is it a safe assumption that you also don't have any custom neo-tree configurations in place (aside from whatever comes with lazyvim)?
@miversen33, sorry i just came home, and the issue is on my working computer, so i can't give the screenshot until Monday. But i can say that i didn't customize my neo-tree configuration before the problem.
The D:\Develop\back-end is a django project, you may pick any random project from GitHub like this for test.
In my opinion, the git-bash in Windows may be the root of the problem, i have got some other issue about slash with git-bash in Windows in my daily use.
Maybe neo-tree get the root dir from pwd command or something, and the git-bash in Windows gives the linux slash style path, which can't be recognized by Windows.
I am fine waiting over the weekend. It doesn't make a lot of sense to me to try and guess at what your filestructure would look like in order to recreate the issue when as it stands I cannot recreate the issue lol. Come monday if you could get as simple as possible a screencap of a filestructure that reproduces your error, I will get something put together to recreate it and we can move forward from there :)
Hi, i'm back, and here is my screenshot:
environment
In git-bash:
In PowerShell:
problem
Case A - root dir:
Case B - cwd:
@hf-xz I am unable to get neovim to even load in gitbash. Mind filling me in on how you have neovim setup for gitbash? A config I can use would be fantastic :)
First, I use scoop to install my git-bash and neovim, like this:
[~] where nvim bash | rg scoop
/c/Users/Administrator/scoop/shims/nvim
/c/Users/Administrator/scoop/shims/bash
[~] scoop list | rg neovim
neovim 0.9.1 main 2023-07-07 14:55:04
[~] scoop list | rg git
git 2.41.0.3 main 2023-07-17 15:58:58
In Windows Terminal, I set the startup command like this: C:\Users\Administrator\scoop\shims\bash.exe --login -i
Then in terminal, you will get this:
[~] echo $SHELL
/usr/bin/bash
However, if you go into /usr/bin and open in explorer(cd /usr/bin && explorer .), you will find the /usr/bin is actually C:\Users\Administrator\scoop\apps\git\2.41.0.3\usr\bin
Now, since nvim.exe is available in /c/Users/Administrator/scoop/shims, just make sure it is in your $PATH, you can do this by either add export PATH=$PATH:/c/Users/Administrator/scoop/shims to your ~/.zshrc or ~/.bashrc or use Windows like way (use control panel)
Using this process, with no more config, you should be able to run neovim in gitbash.
As for LazyVim, I followed the Official guide, but make sure to use powershell and follow the Windows section.
With LazyVim, I start nvim and it automatically install plugins, including neo-tree.
Getting Neovim up and running in git bash is the important thing. I appreciate you, thank you!