feat(telescope): added <a-c>
mapping for telescope pickers to switch to cwd instead of root
This commit is contained in:
@ -105,6 +105,20 @@ function M.telescope(builtin, opts)
|
|||||||
builtin = "find_files"
|
builtin = "find_files"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
if opts.cwd and opts.cwd ~= vim.loop.cwd() then
|
||||||
|
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)
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
require("telescope.builtin")[builtin](opts)
|
require("telescope.builtin")[builtin](opts)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Reference in New Issue
Block a user