From e7c696c60e15564357d4e0c0599c511351b1e807 Mon Sep 17 00:00:00 2001 From: Andre Freitas Date: Thu, 26 Oct 2023 14:08:29 +0100 Subject: [PATCH] fix(telescope): anonymous keymap --- lua/lazyvim/util/telescope.lua | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/lua/lazyvim/util/telescope.lua b/lua/lazyvim/util/telescope.lua index 1d816b80..ae9ec0e2 100644 --- a/lua/lazyvim/util/telescope.lua +++ b/lua/lazyvim/util/telescope.lua @@ -33,15 +33,16 @@ function M.telescope(builtin, opts) end if opts.cwd and opts.cwd ~= vim.loop.cwd() then ---@diagnostic disable-next-line: inject-field + local function open_git_root() + 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.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) + map("i", "", open_git_root) return true end end