summaryrefslogtreecommitdiff
path: root/lua
diff options
context:
space:
mode:
authorTJ DeVries <devries.timothyj@gmail.com>2020-10-25 08:19:09 -0400
committerTJ DeVries <devries.timothyj@gmail.com>2020-10-25 08:19:09 -0400
commit113a516c63fb6e1ae1fb01173ed8fefdf450b08a (patch)
tree94456d9f4505bc17e196920b12b53fe5cb8f6bbb /lua
parent477261e5c06fb627118a8df8077ff47392b8a16f (diff)
feat: Add ability to turn off devicon colors
Diffstat (limited to 'lua')
-rw-r--r--lua/telescope/config.lua1
-rw-r--r--lua/telescope/make_entry.lua7
-rw-r--r--lua/telescope/pickers.lua2
3 files changed, 8 insertions, 2 deletions
diff --git a/lua/telescope/config.lua b/lua/telescope/config.lua
index b01b278..681c074 100644
--- a/lua/telescope/config.lua
+++ b/lua/telescope/config.lua
@@ -60,6 +60,7 @@ function config.set_defaults(defaults)
-- Last argument will be the search term (passed in during execution)
set("vimgrep_arguments", {'rg', '--color=never', '--no-heading', '--with-filename', '--line-number', '--column', '--smart-case'})
set("use_less", true)
+ set("color_devicons", true)
-- TODO: Add motions to keybindings
diff --git a/lua/telescope/make_entry.lua b/lua/telescope/make_entry.lua
index 46fd3c2..bf018d0 100644
--- a/lua/telescope/make_entry.lua
+++ b/lua/telescope/make_entry.lua
@@ -1,5 +1,6 @@
local has_devicons, devicons = pcall(require, 'nvim-web-devicons')
+local conf = require('telescope.config').values
local path = require('telescope.path')
local utils = require('telescope.utils')
@@ -17,7 +18,11 @@ if has_devicons then
local icon, icon_highlight = devicons.get_icon(filename, string.match(filename, '%a+$'), { default = true })
local icon_display = (icon or ' ') .. ' ' .. display
- return icon_display, icon_highlight
+ if conf.color_devicons then
+ return icon_display, icon_highlight
+ else
+ return icon_display
+ end
end
else
transform_devicons = function(_, display, _)
diff --git a/lua/telescope/pickers.lua b/lua/telescope/pickers.lua
index e77e0e9..442b4df 100644
--- a/lua/telescope/pickers.lua
+++ b/lua/telescope/pickers.lua
@@ -803,9 +803,9 @@ function Picker:entry_adder(index, entry, score)
return
end
-
local set_ok = pcall(vim.api.nvim_buf_set_lines, self.results_bufnr, row, row + 1, false, {display})
if set_ok and display_highlights then
+ -- TODO: This should actually be done during the cursor moving stuff annoyingly.... didn't see this bug yesterday.
for _, hl_block in ipairs(display_highlights) do
a.nvim_buf_add_highlight(self.results_bufnr, ns_telescope_entry, hl_block[2], row, #prefix + hl_block[1][1], #prefix + hl_block[1][2])
end