diff --git a/lua/telescope/_extensions/file_browser/finders.lua b/lua/telescope/_extensions/file_browser/finders.lua index 6e12312c..ff533421 100644 --- a/lua/telescope/_extensions/file_browser/finders.lua +++ b/lua/telescope/_extensions/file_browser/finders.lua @@ -68,8 +68,7 @@ local function fd_file_args(opts) if opts.show_symlinks then table.insert(args,"--type") table.insert(args,"symlink") - end - if opts.follow_symlinks then + elseif opts.follow_symlinks then table.insert(args, "--follow") end return args diff --git a/lua/telescope/_extensions/file_browser/make_entry.lua b/lua/telescope/_extensions/file_browser/make_entry.lua index b8cf8986..2cbf4612 100644 --- a/lua/telescope/_extensions/file_browser/make_entry.lua +++ b/lua/telescope/_extensions/file_browser/make_entry.lua @@ -124,10 +124,12 @@ local make_entry = function(opts) local display_array = {} local icon, icon_hl local is_dir = entry.Path:is_dir() + local is_symlink = entry.lstat.type == "link" -- entry.ordinal is path excl. cwd local tail = fb_utils.trim_right_os_sep(entry.ordinal) -- path_display plays better with relative paths local path_display = utils.transform_path(opts, tail) + if is_dir then if entry.value == parent_dir then path_display = string.format("..%s", os_sep) @@ -159,6 +161,10 @@ local make_entry = function(opts) end end + if is_symlink then + path_display = string.format("%s -> %s ",path_display,entry.readlink); + end + local file_width = vim.F.if_nil(opts.file_width, math.max(15, total_file_width)) -- TODO maybe this can be dealt with more cleanly if #path_display > file_width then @@ -238,6 +244,7 @@ local make_entry = function(opts) t.lstat = false else t.lstat = lstat + t.readlink = vim.F.if_nil(vim.loop.fs_readlink(t.value),false) end return t.lstat end