Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(path_display): support filename_first #397

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 12 additions & 8 deletions lua/telescope/_extensions/file_browser/make_entry.lua
Original file line number Diff line number Diff line change
Expand Up @@ -125,14 +125,13 @@ local make_entry = function(opts)
local display_array = {}
local icon, icon_hl

local tail = fb_utils.sanitize_path_str(entry.ordinal)
local path_display = utils.transform_path(opts, tail)
local path_display, style = utils.create_path_display(
entry,
vim.tbl_extend("force", opts, { disable_devicons = true, dir_hl = "TelescopePreviewDirectory" })
)

if entry.is_dir then
if entry.path == parent_dir then
path_display = ".."
end
path_display = path_display .. os_sep
if entry.is_dir and entry.path == parent_dir then
path_display = ".." .. os_sep
end

if not opts.disable_devicons then
Expand Down Expand Up @@ -162,7 +161,12 @@ local make_entry = function(opts)
if #path_display > file_width then
path_display = strings.truncate(path_display, file_width, nil, -1)
end
local display = entry.is_dir and { path_display, "TelescopePreviewDirectory" } or path_display
local display = {
path_display,
function()
return style
end,
}
table.insert(display_array, entry.stat and display or { display, "WarningMsg" })
table.insert(widths, { width = file_width })

Expand Down
Loading