From c49854aa5da470d720ba5ffc197f0e5494ec8826 Mon Sep 17 00:00:00 2001 From: Akin Sowemimo Date: Sat, 26 Feb 2022 13:26:05 +0000 Subject: [PATCH] fix(telescope): allow passing theme options to telescope picker --- lua/dressing/select/telescope.lua | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lua/dressing/select/telescope.lua b/lua/dressing/select/telescope.lua index e6f3c80..936a69a 100644 --- a/lua/dressing/select/telescope.lua +++ b/lua/dressing/select/telescope.lua @@ -4,6 +4,8 @@ M.is_supported = function() return pcall(require, "telescope") end +local defaults = { previewer = false } + M.select = function(config, items, opts, on_choice) local themes = require("telescope.themes") local actions = require("telescope.actions") @@ -21,9 +23,10 @@ M.select = function(config, items, opts, on_choice) } end - local picker_opts = themes[string.format("get_%s", config.theme)]({ - previewer = false, - }) + local picker_opts = type(config.theme) == "table" + and vim.tbl_extend("force", config.theme, defaults) + or themes[string.format("get_%s", config.theme)](defaults) + pickers.new(picker_opts, { prompt_title = opts.prompt, finder = finders.new_table({