Open delphinus opened 5 months ago
This is caused by plenary.nvim
's path.lua itself. Path:normalize()
makes vim.uv.os_homedir()
string into ~
, but ~
is not $HOME
in Cygwin. With this diff below, it works validly.
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 Path:normalize
↓here. This is the problem.
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
.