summaryrefslogtreecommitdiff
path: root/lua/telescope/make_entry.lua
diff options
context:
space:
mode:
Diffstat (limited to 'lua/telescope/make_entry.lua')
-rw-r--r--lua/telescope/make_entry.lua55
1 files changed, 4 insertions, 51 deletions
diff --git a/lua/telescope/make_entry.lua b/lua/telescope/make_entry.lua
index bd1f622..8c793d7 100644
--- a/lua/telescope/make_entry.lua
+++ b/lua/telescope/make_entry.lua
@@ -1,6 +1,3 @@
-local has_devicons, devicons = pcall(require, 'nvim-web-devicons')
-
-local conf = require('telescope.config').values
local entry_display = require('telescope.pickers.entry_display')
local path = require('telescope.path')
local utils = require('telescope.utils')
@@ -32,50 +29,6 @@ local lsp_type_highlight = {
local make_entry = {}
-local transform_devicons
-local get_devicons
-if has_devicons then
- if not devicons.has_loaded() then
- devicons.setup()
- end
-
- transform_devicons = function(filename, display, disable_devicons)
- if disable_devicons or not filename then
- return display
- end
-
- local icon, icon_highlight = devicons.get_icon(filename, string.match(filename, '%a+$'), { default = true })
- local icon_display = (icon or ' ') .. ' ' .. display
-
- if conf.color_devicons then
- return icon_display, icon_highlight
- else
- return icon_display
- end
- end
-
- get_devicons = function(filename, disable_devicons)
- if disable_devicons or not filename then
- return ''
- end
-
- local icon, icon_highlight = devicons.get_icon(filename, string.match(filename, '%a+$'), { default = true })
- if conf.color_devicons then
- return icon, icon_highlight
- else
- return icon
- end
- end
-else
- transform_devicons = function(_, display, _)
- return display
- end
-
- get_devicons = function(_, _)
- return ''
- end
-end
-
do
local lookup_keys = {
display = 1,
@@ -124,7 +77,7 @@ do
display = utils.path_shorten(display)
end
- display, hl_group = transform_devicons(entry.value, display, disable_devicons)
+ display, hl_group = utils.transform_devicons(entry.value, display, disable_devicons)
if hl_group then
return display, { { {1, 3}, hl_group } }
@@ -240,7 +193,7 @@ do
coordinates = string.format("%s:%s:", entry.lnum, entry.col)
end
- local display, hl_group = transform_devicons(
+ local display, hl_group = utils.transform_devicons(
entry.filename,
string.format(display_string, display_filename, coordinates, entry.text),
disable_devicons
@@ -468,7 +421,7 @@ function make_entry.gen_from_buffer(opts)
local icon_width = 0
if not disable_devicons then
- local icon, _ = get_devicons('fname', disable_devicons)
+ local icon, _ = utils.get_devicons('fname', disable_devicons)
icon_width = utils.strdisplaywidth(icon)
end
@@ -492,7 +445,7 @@ function make_entry.gen_from_buffer(opts)
display_bufname = entry.filename
end
- local icon, hl_group = get_devicons(entry.filename, disable_devicons)
+ local icon, hl_group = utils.get_devicons(entry.filename, disable_devicons)
return displayer {
{entry.bufnr, "TelescopeResultsNumber"},