From 36ae4213b89191e040405c5515c24d8021f277d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Freitas?= Date: Thu, 7 Mar 2024 10:49:50 +0000 Subject: [PATCH] fix(telescope): anonymous keymap (#1879) * fix(telescope): anonymous keymap * fix(telescope): add desc * fix(telescope): function name * fix(telescope): update description * fix(telescope): diagnostic disable --- lua/lazyvim/util/telescope.lua | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/lua/lazyvim/util/telescope.lua b/lua/lazyvim/util/telescope.lua index fad24f46..0a51d6aa 100644 --- a/lua/lazyvim/util/telescope.lua +++ b/lua/lazyvim/util/telescope.lua @@ -36,16 +36,18 @@ function M.telescope(builtin, opts) end end if opts.cwd and opts.cwd ~= vim.loop.cwd() then + local function open_cwd_dir() + local action_state = require("telescope.actions.state") + local line = action_state.get_current_line() + M.telescope( + params.builtin, + vim.tbl_deep_extend("force", {}, params.opts or {}, { cwd = false, default_text = line }) + )() + end ---@diagnostic disable-next-line: inject-field opts.attach_mappings = function(_, map) - map("i", "", function() - local action_state = require("telescope.actions.state") - local line = action_state.get_current_line() - M.telescope( - params.builtin, - vim.tbl_deep_extend("force", {}, params.opts or {}, { cwd = false, default_text = line }) - )() - end) + -- opts.desc is overridden by telescope, until it's changed there is this fix + map("i", "", open_cwd_dir, { desc = "Open cwd directory" }) return true end end