From b7eb46e0cf290c2682feaed4960d617fbdccf85b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sergio=20La=C3=ADn?= Date: Tue, 7 Jan 2025 23:55:04 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix(nvim):=20yanky=20options=20t?= =?UTF-8?q?o=20support=20fzf-lua?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../plugins/extras/coding/yanky-extended.lua | 49 ++++++++++--------- 1 file changed, 25 insertions(+), 24 deletions(-) diff --git a/.config/nvim/lua/plugins/extras/coding/yanky-extended.lua b/.config/nvim/lua/plugins/extras/coding/yanky-extended.lua index 6fb33140..f3edc4d4 100644 --- a/.config/nvim/lua/plugins/extras/coding/yanky-extended.lua +++ b/.config/nvim/lua/plugins/extras/coding/yanky-extended.lua @@ -5,38 +5,39 @@ return { { "gbprod/yanky.nvim", opts = function(_, opts) - local utils = require("yanky.utils") - local mapping = require("yanky.telescope.mapping") - opts.highlight = { timer = 250 } - opts.picker = { - telescope = { - use_default_mappings = false, - mappings = { - default = mapping.put("p"), - i = { - [""] = mapping.put("p"), - [""] = mapping.put("P"), - [""] = mapping.delete(), - [""] = mapping.set_register(utils.get_default_register()), - }, - n = { - p = mapping.put("p"), - P = mapping.put("P"), - d = mapping.delete(), - r = mapping.set_register(utils.get_default_register()), + + if LazyVim.has("telescope.nvim") then + local utils = require("yanky.utils") + local mapping = require("yanky.telescope.mapping") + opts.picker = { + telescope = { + use_default_mappings = false, + mappings = { + default = mapping.put("p"), + i = { + [""] = mapping.put("p"), + [""] = mapping.put("P"), + [""] = mapping.delete(), + [""] = mapping.set_register(utils.get_default_register()), + }, + n = { + p = mapping.put("p"), + P = mapping.put("P"), + d = mapping.delete(), + r = mapping.set_register(utils.get_default_register()), + }, }, }, - }, - } + } + end end, keys = { { "sy", function() - local ok, telescope = pcall(require, "telescope") - if ok then - telescope.extensions.yank_history.yank_history({}) + if LazyVim.pick.picker.name == "telescope" then + require("telescope").extensions.yank_history.yank_history({}) else vim.cmd([[YankyRingHistory]]) end