nvim-telescope / telescope-live-grep-args.nvim

Live grep with args
726 stars 40 forks source link

Can't get custom mappings to work #41

Closed cacauisadog closed 5 months ago

cacauisadog commented 1 year ago

Hello! I've installed and setup this plugin, and it works nicely. The one problem I'm having, which is probably a me problem, is that I can't seem to make the custom mappings work.

I installed the plugin with packer:

use "nvim-telescope/telescope-live-grep-args.nvim"

Then, in a separate telescope.lua file I use just to configure telescope itself, I load the extension and the actions:

local status_ok, telescope = pcall(require, "telescope")
if not status_ok then
  return
end

local lga_status_ok, lga_actions = pcall(require, "telescope-live-grep-args.nvim")
if not lga_status_ok then
  return
end

telescope.load_extension("live_grep_args")

And the setup function:

telescope.setup {
  defaults = { ... },
  pickers = { ... },
  extensions = {
    live_grep_args = {
      auto_quoting = true,
      theme = "ivy",
      mappings = {
        i = { ["<C-f>"] = lga_actions.quote_prompt({ postfix = " -t"}),
      }
    }
  }
}

but it doesn't work, neither the mappings nor the theme. I'm almost sure there is something I'm doing wrong - maybe the load order is whacky?

Thanks in advance.

sirfz commented 1 year ago

For what it's worth, I had the same issue when I had extensions configured inside defaults. Once I moved them outside, the mappings worked (although I see you already do that in your post).

weeman1337 commented 1 year ago

The order should be

  1. setup
  2. load_extension

Is your entire setup available somewhere @cacauisadog ?

ogrish55 commented 1 year ago

image If anyone else experience this issue, this fixed the problem for me. Following weeman1337's advice.

weeman1337 commented 1 year ago

Thanks @ogrish55 . I will keep this issue open until I updated the README.

idelice commented 8 months ago

Thanks @ogrish55 . I will keep this issue open until I updated the README.

i think it's about time you update the docs :D