From 388016c51299ed4995bd8c6726b3d5096ecf4251 Mon Sep 17 00:00:00 2001 From: Munif Tanjim Date: Fri, 12 Aug 2022 19:42:13 +0600 Subject: [PATCH] fix: show icon before directory (#67) --- lua/telescope/_extensions/frecency.lua | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/lua/telescope/_extensions/frecency.lua b/lua/telescope/_extensions/frecency.lua index 6ed33f6..1a26738 100644 --- a/lua/telescope/_extensions/frecency.lua +++ b/lua/telescope/_extensions/frecency.lua @@ -95,12 +95,12 @@ local frecency = function(opts) end local res = {} res[1] = state.show_scores and { width = 8 } or nil - if state.show_filter_column then - table.insert(res, { width = directory_col_width }) - end if has_devicons and not state.disable_devicons then table.insert(res, { width = 2 }) -- icon column end + if state.show_filter_column then + table.insert(res, { width = directory_col_width }) + end table.insert(res, { remaining = true }) return res end @@ -121,6 +121,11 @@ local frecency = function(opts) display_items = state.show_scores and { { entry.score, "TelescopeFrecencyScores" } } or {} + if has_devicons and not state.disable_devicons then + icon, icon_highlight = devicons.get_icon(entry.name, string.match(entry.name, "%a+$"), { default = true }) + table.insert(display_items, { icon, icon_highlight }) + end + -- TODO: store the column lengths here, rather than recalculating in get_display_cols() if state.show_filter_column then local filter_path = "" @@ -135,10 +140,6 @@ local frecency = function(opts) table.insert(display_items, { filter_path, "Directory" }) end - if has_devicons and not state.disable_devicons then - icon, icon_highlight = devicons.get_icon(entry.name, string.match(entry.name, "%a+$"), { default = true }) - table.insert(display_items, { icon, icon_highlight }) - end table.insert(display_items, { display_filename, hl_filename }) return displayer(display_items)