From 361a172fceef1caca1e16b51a2556ec3bb73a576 Mon Sep 17 00:00:00 2001 From: Simon Hauser Date: Fri, 2 Dec 2022 10:21:44 +0100 Subject: [PATCH] fix: icons with multiple dots but without custom overrides (#2256) --- doc/telescope.txt | 62 ++++++++++++++++++++++------------------- lua/telescope/utils.lua | 10 +++++-- 2 files changed, 42 insertions(+), 30 deletions(-) diff --git a/doc/telescope.txt b/doc/telescope.txt index 9c1a97b..3f26437 100644 --- a/doc/telescope.txt +++ b/doc/telescope.txt @@ -838,26 +838,31 @@ builtin.find_files({opts}) *telescope.builtin.find_files()* {opts} (table) options to pass to the picker Options: ~ - {cwd} (string) root dir to search from (default: - cwd, use utils.buffer_dir() to - search relative to open buffer) - {find_command} (function|table) cmd to use for the search. Can be - a fn(opts) -> tbl (default: - autodetect) - {file_entry_encoding} (string) encoding of output of `find_command` - {follow} (boolean) if true, follows symlinks (i.e. - uses `-L` flag for the `find` - command) - {hidden} (boolean) determines whether to show hidden - files or not (default: false) - {no_ignore} (boolean) show files ignored by .gitignore, - .ignore, etc. (default: false) - {no_ignore_parent} (boolean) show files ignored by .gitignore, - .ignore, etc. in parent dirs. - (default: false) - {search_dirs} (table) directory/directories/files to - search - {search_file} (string) specify a filename to search for + {cwd} (string) root dir to search from + (default: cwd, use + utils.buffer_dir() to search + relative to open buffer) + {find_command} (function|table) cmd to use for the search. Can + be a fn(opts) -> tbl (default: + autodetect) + {file_entry_encoding} (string) encoding of output of + `find_command` + {follow} (boolean) if true, follows symlinks + (i.e. uses `-L` flag for the + `find` command) + {hidden} (boolean) determines whether to show + hidden files or not (default: + false) + {no_ignore} (boolean) show files ignored by + .gitignore, .ignore, etc. + (default: false) + {no_ignore_parent} (boolean) show files ignored by + .gitignore, .ignore, etc. in + parent dirs. (default: false) + {search_dirs} (table) directory/directories/files to + search + {search_file} (string) specify a filename to search + for builtin.fd() *telescope.builtin.fd()* @@ -1344,14 +1349,15 @@ builtin.keymaps({opts}) *telescope.builtin.keymaps()* {opts} (table) options to pass to the picker Options: ~ - {modes} (table) a list of short-named keymap modes to search - (default: { "n", "i", "c", "x" }) - {show_plug} (boolean) if true, the keymaps for which the lhs contains - "" are also shown (default: true) - {only_buf} (boolean) if true, only show the buffer-local keymaps - (default: false) - {lhs_filter} (function) filter(lhs:string) -> boolean. true if the - keymap should be shown (optional) + {modes} (table) a list of short-named keymap modes to search + (default: { "n", "i", "c", "x" }) + {show_plug} (boolean) if true, the keymaps for which the lhs + contains "" are also shown (default: + true) + {only_buf} (boolean) if true, only show the buffer-local keymaps + (default: false) + {lhs_filter} (function) filter(lhs:string) -> boolean. true if the + keymap should be shown (optional) builtin.filetypes({opts}) *telescope.builtin.filetypes()* diff --git a/lua/telescope/utils.lua b/lua/telescope/utils.lua index 97ef2e3..f2ab21e 100644 --- a/lua/telescope/utils.lua +++ b/lua/telescope/utils.lua @@ -457,7 +457,10 @@ utils.transform_devicons = load_once(function() end local basename = utils.path_tail(filename) - local icon, icon_highlight = devicons.get_icon(basename, utils.file_extension(basename), { default = true }) + local icon, icon_highlight = devicons.get_icon(basename, utils.file_extension(basename), { default = false }) + if not icon then + icon, icon_highlight = devicons.get_icon(basename, nil, { default = true }) + end local icon_display = (icon or " ") .. " " .. (display or "") if conf.color_devicons then @@ -488,7 +491,10 @@ utils.get_devicons = load_once(function() end local basename = utils.path_tail(filename) - local icon, icon_highlight = devicons.get_icon(basename, utils.file_extension(basename), { default = true }) + local icon, icon_highlight = devicons.get_icon(basename, utils.file_extension(basename), { default = false }) + if not icon then + icon, icon_highlight = devicons.get_icon(basename, nil, { default = true }) + end if conf.color_devicons then return icon, icon_highlight else