mirror of
https://github.com/LazyVim/LazyVim.git
synced 2025-07-13 19:04:36 +02:00
Merge 625d5b4011
into 25abbf546d
This commit is contained in:
commit
7e5e8decb3
1 changed files with 13 additions and 2 deletions
|
@ -101,9 +101,20 @@ function M.pretty_path(opts)
|
|||
local root = LazyVim.root.get({ normalize = true })
|
||||
local cwd = LazyVim.root.cwd()
|
||||
|
||||
if opts.relative == "cwd" and path:find(cwd, 1, true) == 1 then
|
||||
-- original path is preserved to provide user with expected result of pretty_path, not a normalized one,
|
||||
-- which might be confusing
|
||||
local norm_path = path
|
||||
|
||||
if LazyVim.is_win() then
|
||||
-- in case any of the provided paths involved mixed case, an additional normalization step for windows
|
||||
norm_path = norm_path:lower()
|
||||
root = root:lower()
|
||||
cwd = cwd:lower()
|
||||
end
|
||||
|
||||
if opts.relative == "cwd" and norm_path:find(cwd, 1, true) == 1 then
|
||||
path = path:sub(#cwd + 2)
|
||||
elseif path:find(root, 1, true) == 1 then
|
||||
elseif norm_path:find(root, 1, true) == 1 then
|
||||
path = path:sub(#root + 2)
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue