fdschmidt93 / telescope-egrepify.nvim

Variable user customization for telescope.live_grep to set rg flags on-the-fly
MIT License
122 stars 13 forks source link

Does not support telescope built-in keymappings? #25

Closed kohane27 closed 1 year ago

kohane27 commented 1 year ago

Description

Hello there. Hope you're doing well. Thank you for creating this very useful telescope plugin! I especially appreciate the option for permutations! However, I have encountered the following problem.

I have the following error when I press the built-in telescope keymappings like <C-d>:

E5108: Error executing lua: ...hare/nvim/lazy/telescope.nvim/lua/telescope/mappings.lua:257: attempt to call upvalue 'key_func' (a table value)
stack traceback:
        ...hare/nvim/lazy/telescope.nvim/lua/telescope/mappings.lua:257: in function <...hare/nvim/lazy/telescope.nvim/lua/telescope/mappings.lua:256>

Neovim version

NVIM v0.9.4
Build type: Release
LuaJIT 2.1.1697887905

Operating system and version

Linux 6.1.61-1-lts

Steps to reproduce

  1. :lua require("telescope").extensions.egrepify.egrepify()
  2. search function
  3. press <C-d> or <C-u>
  4. error triggered

Actual behavior

https://github.com/fdschmidt93/telescope-egrepify.nvim/assets/57322459/9d1ca990-bccf-4e30-89be-50b2a4dd4ef4

Minimal config

vim.cmd([[set runtimepath=$VIMRUNTIME]])
vim.cmd([[set packpath=/tmp/nvim/site]])
local package_root = "/tmp/nvim/site/pack"
local lazypath = package_root .. "/lazy/lazy.nvim"
local pluginpath = package_root .. "/plugins/"
if not vim.loop.fs_stat(lazypath) then
    print("Installing 'folke/lazy.nvim'...")
    vim.fn.system({ "git", "clone", "https://github.com/folke/lazy.nvim.git", lazypath })
end
vim.opt.rtp:prepend(lazypath)

require("lazy").setup({
    {
        "fdschmidt93/telescope-egrepify.nvim",
        keys = {
            { "<space>rg", "<CMD>Telescope egrepify<CR>", mode = { "n", "i", "v" } },
        },
    },
    {
        "nvim-telescope/telescope.nvim",
        dependencies = "nvim-lua/plenary.nvim",
        config = function()
            local actions = require("telescope.actions")
            require("telescope").setup({
                n = {
                    -- below works with `telescope-egrepify`
                    ["<C-w>s"] = actions.select_horizontal,
                    ["<C-w>v"] = actions.select_vertical,
                    ["<C-w>t"] = actions.select_tab,
                    ["j"] = actions.move_selection_next,
                    ["k"] = actions.move_selection_previous,

                    -- below DOES NOT work with `telescope-egrepify`
                    ["<Tab>"] = actions.toggle_selection + actions.move_selection_worse,
                    ["<C-u>"] = actions.move_selection_previous
                        + actions.move_selection_previous
                        + actions.move_selection_previous
                        + actions.move_selection_previous
                        + actions.move_selection_previous,

                    ["<C-d>"] = actions.move_selection_next
                        + actions.move_selection_next
                        + actions.move_selection_next
                        + actions.move_selection_next
                        + actions.move_selection_next,
                },
            })
            require("telescope").load_extension("egrepify")
        end,
    },
}, { root = pluginpath })

Thank you again!