Skip to content

Commit

Permalink
Make a working example of how link showing can work
Browse files Browse the repository at this point in the history
  • Loading branch information
aadi58002 committed Nov 13, 2023
1 parent c349ad9 commit 6113d5f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
3 changes: 1 addition & 2 deletions lua/telescope/_extensions/file_browser/finders.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 7 additions & 0 deletions lua/telescope/_extensions/file_browser/make_entry.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 6113d5f

Please sign in to comment.