Skip to content

Commit 054247b

Browse files
committed
fix: path shortening does proper subpath detection
1 parent 1641357 commit 054247b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lua/oil/fs.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,14 +116,14 @@ local home_dir = assert(uv.os_homedir())
116116
---@return string
117117
M.shorten_path = function(path)
118118
local cwd = vim.fn.getcwd()
119-
if vim.startswith(path, cwd) then
119+
if M.is_subpath(cwd, path) then
120120
local relative = path:sub(cwd:len() + 2)
121121
if relative == "" then
122122
relative = "."
123123
end
124124
return relative
125125
end
126-
if vim.startswith(path, home_dir) then
126+
if M.is_subpath(home_dir, path) then
127127
return "~" .. path:sub(home_dir:len() + 1)
128128
end
129129
return path

0 commit comments

Comments
 (0)