fix(telescope): anonymous keymap

This commit is contained in:
Andre Freitas 2023-10-26 14:08:29 +01:00
parent 7831fc94ca
commit e7c696c60e

View file

@ -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", "<a-c>", 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", "<a-c>", open_git_root)
return true
end
end