Hydra Telescope Heads
Hi,
I have a Hydra mode for my telescope mappings which is as follows:
local Hydra = require("hydra")
local function cmd(command)
return table.concat({ "<Cmd>", command, "<CR>" })
end
local hint = [[
_f_: files _p_: projects
_t_: live grep _s_: grep string
_H_: header _S_: symbols
_R_: register _P_: plugins
_h_: vim help _c_: execute command
_k_: keymaps _;_: commands history
_O_: options _?_: search history
_/_: search in file _m_: make
_r_: recently opened files
^
_<Enter>_: Telescope _q_: Exit
]]
Hydra({
name = "Telescope",
hint = hint,
config = {
invoke_on_body = true,
hint = {
position = "middle",
border = "rounded",
},
},
mode = "n",
body = "<Leader>s",
heads = {
{ "c", cmd("Telescope commands"), { desc = "execute command" } },
{ "f", cmd("Telescope find_files") },
{ "t", cmd("Telescope live_grep") },
{ "h", cmd("Telescope help_tags"), { desc = "vim help" } },
{ "H", cmd("Telescope heading") },
{ "k", cmd("Telescope keymaps") },
{ "O", cmd("Telescope vim_options") },
{ "m", cmd("Telescope make") },
{ "p", cmd("Telescope projects"), { desc = "projects" } },
{ "P", cmd("Telescope packer") },
{ "r", cmd("Telescope oldfiles"), { desc = "recently opened files" } },
{ "R", cmd("Telescope registers") },
{ "s", cmd("Telescope grep_string"), { desc = "Text under cursor" } },
{ "S", cmd("Telescope symbols") },
{ "/", cmd("Telescope current_buffer_fuzzy_find"), { desc = "search in file" } },
{ "?", cmd("Telescope search_history"), { desc = "search history" } },
{ ";", cmd("Telescope command_history"), { desc = "command-line history" } },
{ "<Enter>", cmd("Telescope"), { exit = true, desc = "list all pickers" } },
{ "q", nil, { exit = true, nowait = true } },
},
})
Since a couple of days whenever I call Telescope via a head Telescope is always started in normal mode despite the following config for telescope:
telescope.setup({
defaults = {
initial_mode = "insert",
}
})
When starting Telescope via :Telescope live_grep it starts in insert mode as expected.
Thanks
Yes, I faced this issue too. See 58e7e7ae1c9cc8d587fb6beda4e90a8147069a30
Sry, I don't understand your reference?
I do not pass additional parameters to Telescope commands so I should not be affected by https://github.com/anuvyklack/hydra.nvim/commit/58e7e7ae1c9cc8d587fb6beda4e90a8147069a3?. I set initial_mode in my telescope configuration itself
I mean, the problem you are described is due to 58e7e7a commit. But I can't revert it because it fixes another, more important issue.
I will see what I can do more.
Thanks for your clarification!
Hi @anuvyklack, Unfortunately, https://github.com/anuvyklack/hydra.nvim/commit/fa814c478a69d0bc05c3e2cdda34336b7484ea05 is not fixing the issue for me :(
Can't reproduce. What is the last working commit?
Check the telescope branch.
ea91aa820a6cecc57bde764bb23612fff26a15de is working and 58e7e7ae1c9cc8d587fb6beda4e90a8147069a30 isn't working anymore. I didn't check commits after 58e7e7ae1c9cc8d587fb6beda4e90a8147069a30.
telescope branch has the same issue.
Maybe helpful: here is my hydra config stuff and here my telescope config.
I just built my (bloated) Dockerimage and can reproduce the issue there as well
I currently have hydra pinned to 928855b69f55c7abcaa6594d20968c33ab2317e6 and I did check each commit after that one. Like @Allaman said, https://github.com/anuvyklack/hydra.nvim/commit/58e7e7ae1c9cc8d587fb6beda4e90a8147069a30 is the commit that causes the issue and the telescope branch doesn't fix this issue either