Skip to content

Commit

Permalink
fix(paths): HOME_to_tilde case insensitive on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
ibhagwan committed Jan 15, 2024
1 parent a22cfce commit d023e8e
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion lua/fzf-lua/path.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit d023e8e

Please sign in to comment.