-
Notifications
You must be signed in to change notification settings - Fork 37
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
Cannot open files in home directory in Cygwin #170
Comments
This is caused by diff --git a/lua/plenary/path.lua b/lua/plenary/path.lua
index a253859..64df772 100644
--- a/lua/plenary/path.lua
+++ b/lua/plenary/path.lua
@@ -368,16 +368,18 @@ function Path:normalize(cwd)
self:make_relative(cwd)
- -- Substitute home directory w/ "~"
- -- string.gsub is not useful here because usernames with dashes at the end
- -- will be seen as a regexp pattern rather than a raw string
- local home = path.home
- if string.sub(path.home, -1) ~= path.sep then
- home = home .. path.sep
- end
- local start, finish = string.find(self.filename, home, 1, true)
- if start == 1 then
- self.filename = "~" .. path.sep .. string.sub(self.filename, (finish + 1), -1)
+ if path.home == vim.env.HOME then
+ -- Substitute home directory w/ "~"
+ -- string.gsub is not useful here because usernames with dashes at the end
+ -- will be seen as a regexp pattern rather than a raw string
+ local home = path.home
+ if string.sub(path.home, -1) ~= path.sep then
+ home = home .. path.sep
+ end
+ local start, finish = string.find(self.filename, home, 1, true)
+ if start == 1 then
+ self.filename = "~" .. path.sep .. string.sub(self.filename, (finish + 1), -1)
+ end
end
return _normalize_path(clean(self.filename), self._cwd) Should we change this? Still considering. |
telescope.nvim calls |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ref #164
This is because
vim.uv.os_homedir()
returnsC:\Users\foo
, but the exact home directory ($HOME
) in Cygwin isC:\cygwin64\home\foo
.procedure to fail opening files
:cd C:\Windows
(outside of the home directory):Telescope frecency
and try to openC:\Users\foo\AppData\Local\Nvim\init.lua
~\AppData\Local\Nvim\init.lua
.~\AppData\Local\Nvim\init.lua
, and then fails. This is because~
is notC:\Users\foo
but\home\foo
in Cygwin.procedure to open files successfully
:cd C:\Users\foo
(home directory):Telescope frecency
and try to openC:\Users\foo\AppData\Local\Nvim\init.lua
AppData\Local\Nvim\init.lua
.The text was updated successfully, but these errors were encountered: