Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Telescope's Ctrl + / on open panel throwing error "Invalid 'event': 'User TelescopeKeymap'" #4551

Closed
eulersson opened this issue May 3, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@eulersson
Copy link

Problem description

I was trying to run the keymaps for the telescope view, it shows them but an error Invalid 'event': 'User TelescopeKeymap' is thrown.

────────────────────────────────────────────────────────────────────────────── Insert Mode Keymaps ──────────────────────────────────────────────────────────────────────────────

    i -> <CR>    -> <anonymous>                     i -> <C-L>   -> complete_tag                    i -> <C-X>   -> select_horizontal
    i -> <C-N>   -> <anonymous>                     i -> <Down>  -> move_selection_next             i -> <C-T>   -> select_tab

[telescope.actions.which_key]: No name available for anonymous functions.
Error executing vim.schedule lua callback: ...k/lazy/opt/telescope.nvim/lua/telescope/actions/init.lua:1260: Invalid 'event': 'User TelescopeKeymap'
stack traceback:
        [C]: in function 'nvim_create_autocmd'
        ...k/lazy/opt/telescope.nvim/lua/telescope/actions/init.lua:1260: in function <...k/lazy/opt/telescope.nvim/lua/telescope/actions/init.lua:1259>
Press ENTER or type command to continue

Related issues:

LunarVim version

release-1.3/neovim-0.9-d1c1bace-dirty

Neovim version (>= 0.9.1)

NVIM v0.9.5

Terminal name

iTerm2

Operating system/version

macOS 14.4.1

Steps to reproduce

  1. Use a fresh LunarVim installation
  2. Run any command that uses Telescope, for instance <Leader>sh to browse help files.
  3. Press Ctrl+/ to list the available keyboard shortcuts that you have available on that telescope view.

Result: It shows the mappings but an error along with them in :messages (that's why I couldn't copy paste it properly).
Should: Not throw that error.

Screenshots

Screenshot 2024-05-03 at 07 14 12
@eulersson eulersson added the bug Something isn't working label May 3, 2024
@kylo252
Copy link
Collaborator

kylo252 commented May 3, 2024

can you check which version of telescope you're one? It should be nvim-telescope/telescope.nvim@d909568
:Lazy log telescope.nvim

I can't quite reproduce the issue since I don't have a dedicated key for / on my ISO keyboard (at least it doesn't seem to behave the same even with the layout set to US INTL), but <C-h> works for me when set manually:

local _, actions = pcall(require, "telescope.actions")
local _, builtin = pcall(require, "telescope.builtin")
lvim.builtin.telescope.defaults.mappings = {
  i = {
    ["<C-c>"] = actions.close,
    ["<C-j>"] = actions.cycle_history_next,
    ["<C-k>"] = actions.cycle_history_prev,
    ["<S-Up>"] = actions.cycle_previewers_prev,
    ["<S-Down>"] = actions.cycle_previewers_next,
    ["<C-q>"] = actions.smart_send_to_qflist + actions.open_qflist,
    ["<CR>"] = actions.select_default + actions.center,
    ["<C-/>"] = actions.which_key,
    ["<C-h>"] = actions.which_key, -- keys from pressing <C-/>
    -- ["<C-i>"] = my_cool_custom_action,
  },
  n = {
    ["<C-c>"] = actions.close,
    ["<S-Up>"] = actions.cycle_previewers_prev,
    ["<S-Down>"] = actions.cycle_previewers_next,
    ["<C-q>"] = actions.smart_send_to_qflist + actions.open_qflist,
    -- ["<C-Space>"] = custom_actions.fuzzy_filter_results,
    -- ["<C-i>"] = my_cool_custom_action,
  },
}

@eulersson
Copy link
Author

:Lazy log telescope.nvim tells me 9de317b instead of d909568, why is that? 🤔

This is my LunarVim configuration: https://github.com/eulersson/dotfiles/blob/main/.config/lvim/config.lua

If I drop the snippet of lua you pasted on the top of my config.lua the issue persists when I do <C-h>, same error comes up. What is a good way to try without any of my stuff? When I tried to reproduce it I simply renamted ~/.config/lvim to ~/.config/ignore-lvim.

    ● telescope.nvim 29.89ms   ChatGPT.nvim
        dir    /Users/ramon/.local/share/lunarvim/site/pack/lazy/opt/telescope.nvim
        url    https://github.com/nvim-telescope/telescope.nvim
        branch 0.1.x
        commit 9de317b
        readme README.md
        help   |telescope.theprimeagen|
        help   |telescope.nvim|
        help   |telescope.changelog|
        cmd      Telescope 
  
      ✔ [task] log 54.99ms

@juicy-g
Copy link
Contributor

juicy-g commented May 11, 2024

I can reproduce the issue in release-1.3/neovim-0.9-d1c1bace and I also get telescope version 9de317b as per the snapshot of release 1.3, The issue doesn't occur in master so hopefully a new release will fix it.

@kylo252
Copy link
Collaborator

kylo252 commented May 15, 2024

@kylo252 kylo252 closed this as completed May 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants