From 189f1444c50a579d8abb8a842b621ddafae5796e Mon Sep 17 00:00:00 2001 From: say Date: Mon, 11 May 2026 21:01:17 -0700 Subject: [PATCH] fix(telescope): respect copy_to_clipboard in extensions The Telescope nerdy and nerdy_recents extensions ignored the copy_to_clipboard config and always inserted the icon into the buffer. Mirror the single_select/multi_select behavior from fetcher.lua so the extensions honor copy_to_clipboard and copy_register. Fixes #25 Signed-off-by: say --- lua/telescope/_extensions/nerdy_icons.lua | 7 ++++++- lua/telescope/_extensions/nerdy_recents.lua | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/lua/telescope/_extensions/nerdy_icons.lua b/lua/telescope/_extensions/nerdy_icons.lua index 034241a..7b9e99f 100644 --- a/lua/telescope/_extensions/nerdy_icons.lua +++ b/lua/telescope/_extensions/nerdy_icons.lua @@ -6,6 +6,7 @@ local action_state = require('telescope.actions.state') local icon_list = require('nerdy.icons') local recent_utils = require('nerdy.recents') +local config_module = require('nerdy.config') return function(opts) opts = opts or require('telescope.themes').get_dropdown({}) @@ -29,7 +30,11 @@ return function(opts) local icon = selected_entry.char recent_utils.add_to_recent(selected_entry) actions.close(prompt_bufnr) - vim.api.nvim_put({ icon }, 'c', true, true) + if config_module.config.copy_to_clipboard then + vim.fn.setreg(config_module.config.copy_register or '+', icon) + else + vim.api.nvim_put({ icon }, 'c', true, true) + end end) return true end, diff --git a/lua/telescope/_extensions/nerdy_recents.lua b/lua/telescope/_extensions/nerdy_recents.lua index 1278b90..9507a5f 100644 --- a/lua/telescope/_extensions/nerdy_recents.lua +++ b/lua/telescope/_extensions/nerdy_recents.lua @@ -5,6 +5,7 @@ local actions = require('telescope.actions') local action_state = require('telescope.actions.state') local recent_utils = require('nerdy.recents') +local config_module = require('nerdy.config') return function(opts) local recent_icons = recent_utils.load_recent_icons() @@ -35,7 +36,11 @@ return function(opts) local icon = selected_entry.char recent_utils.add_to_recent(selected_entry) actions.close(prompt_bufnr) - vim.api.nvim_put({ icon }, 'c', true, true) + if config_module.config.copy_to_clipboard then + vim.fn.setreg(config_module.config.copy_register or '+', icon) + else + vim.api.nvim_put({ icon }, 'c', true, true) + end end) return true end,