fix: shortened path for current directory is '.'
This commit is contained in:
parent
ce66f47751
commit
7649866650
1 changed files with 5 additions and 1 deletions
|
|
@ -73,7 +73,11 @@ local home_dir = vim.loop.os_homedir()
|
||||||
M.shorten_path = function(path)
|
M.shorten_path = function(path)
|
||||||
local cwd = vim.fn.getcwd()
|
local cwd = vim.fn.getcwd()
|
||||||
if vim.startswith(path, cwd) then
|
if vim.startswith(path, cwd) then
|
||||||
return path:sub(cwd:len() + 2)
|
local relative = path:sub(cwd:len() + 2)
|
||||||
|
if relative == "" then
|
||||||
|
relative = "."
|
||||||
|
end
|
||||||
|
return relative
|
||||||
end
|
end
|
||||||
if vim.startswith(path, home_dir) then
|
if vim.startswith(path, home_dir) then
|
||||||
return "~" .. path:sub(home_dir:len() + 1)
|
return "~" .. path:sub(home_dir:len() + 1)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue