From 772dd5c32fb9f6cefd2820d60f2e8d87e64fc0d6 Mon Sep 17 00:00:00 2001 From: patnr Date: Wed, 11 Sep 2024 12:09:11 +0200 Subject: [PATCH] fix(lualine): weird path truncation when not under cwd/root It does not make sense to truncate unless root actually in path. Also, should probably check if opts.relative == "root" otherwise the substitution can be surprising (since user expects substitution only wrt. cwd) --- lua/lazyvim/util/lualine.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/lazyvim/util/lualine.lua b/lua/lazyvim/util/lualine.lua index 6284504a..5473000e 100644 --- a/lua/lazyvim/util/lualine.lua +++ b/lua/lazyvim/util/lualine.lua @@ -96,7 +96,7 @@ function M.pretty_path(opts) if opts.relative == "cwd" and path:find(cwd, 1, true) == 1 then path = path:sub(#cwd + 2) - else + elseif opts.relative == "root" and path:find(root, 1, true) == 1 then path = path:sub(#root + 2) end