From 138697980b68ce7d4f0661c752691ffe5dbb72b0 Mon Sep 17 00:00:00 2001 From: Nazeeh ElDirghami <32499832+Nazeehe@users.noreply.github.com> Date: Fri, 16 Jul 2021 08:20:25 -0700 Subject: feat: Add ability to have a user defined function to format the path display (#1000) --- lua/telescope/utils.lua | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'lua/telescope/utils.lua') diff --git a/lua/telescope/utils.lua b/lua/telescope/utils.lua index 4b2b56b..9238ab7 100644 --- a/lua/telescope/utils.lua +++ b/lua/telescope/utils.lua @@ -274,12 +274,16 @@ end utils.transform_path = function(opts, path) local path_display = utils.get_default(opts.path_display, require('telescope.config').values.path_display) + local transformed_path = path + + if type(path_display) == "function" then + return path_display(opts, transformed_path) + end + if utils.is_path_hidden(nil, path_display) then return '' end - local transformed_path = path - if vim.tbl_contains(path_display, "tail") then transformed_path = utils.path_tail(transformed_path) else -- cgit v1.2.3