diff --git a/lua/fzf-lua/path.lua b/lua/fzf-lua/path.lua index 3e8a3b88..ef3247af 100644 --- a/lua/fzf-lua/path.lua +++ b/lua/fzf-lua/path.lua @@ -249,7 +249,16 @@ end ---@param path string? ---@return string? function M.HOME_to_tilde(path) - return path and path:gsub("^" .. utils.lua_regex_escape(M.HOME()), "~") or nil + if not path then return end + if utils.__IS_WINDOWS then + local home = M.HOME() + if path:sub(1, #home):lower() == home:lower() then + path = "~" .. path:sub(#home + 1) + end + else + path = path:gsub("^" .. utils.lua_regex_escape(M.HOME()), "~") + end + return path end local function find_next_separator(str, start_idx)