From 180f5de5b86deb69f53ad09e3eb305c312bd5c58 Mon Sep 17 00:00:00 2001 From: Jackson Cooper Date: Fri, 13 May 2022 15:28:03 +1000 Subject: [PATCH] Support tilde as home path in the absolute file paths (#676) * Support tile as home path in the absolute file paths --- README.md | 1 + lua/lualine/components/filename.lua | 3 +++ 2 files changed, 4 insertions(+) diff --git a/README.md b/README.md index 3ab0657..ead8f1e 100644 --- a/README.md +++ b/README.md @@ -550,6 +550,7 @@ sections = { path = 0, -- 0: Just the filename -- 1: Relative path -- 2: Absolute path + -- 3: Absolute path, with tilde as the home directory shorting_target = 40, -- Shortens path to leave 40 spaces in the window -- for other components. (terrible name, any suggestions?) diff --git a/lua/lualine/components/filename.lua b/lua/lualine/components/filename.lua index dfaf3f3..f68dba7 100644 --- a/lua/lualine/components/filename.lua +++ b/lua/lualine/components/filename.lua @@ -43,6 +43,9 @@ M.update_status = function(self) elseif self.options.path == 2 then -- absolute path data = vim.fn.expand('%:p') + elseif self.options.path == 3 then + -- absolute path, with tilde + data = vim.fn.expand('%:p:~') else -- just filename data = vim.fn.expand('%:t')