mirror of
https://github.com/LazyVim/LazyVim.git
synced 2025-06-23 17:28:57 +02:00
feat(telescope): added <a-c>
mapping for telescope pickers to switch to cwd instead of root
This commit is contained in:
parent
78354a1e5e
commit
c737f2b6c2
1 changed files with 14 additions and 0 deletions
|
@ -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
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue