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

Live grep with args
727 stars 40 forks source link

Disable default mappings #26

Closed Tej12345 closed 2 years ago

Tej12345 commented 2 years ago

Please add the ability to disable default mappings. Since Ctrl-K for me is mapped to cycle through telescope history, but telescope-live-grep-args forces its behaviour...

local default_mappings = {
  i = {
    ["<C-k>"] = actions.quote_prompt(), -- k for kwote :D - q is already taken
    ["<C-l>g"] = actions.quote_prompt({ postfix = ' --iglob ' }), -- l for live grep args; g for glob
    ["<C-l>t"] = actions.quote_prompt({ postfix = ' -t' }), -- l for live grep args; t for type
  },
}

local live_grep_args = function(opts)
  opts = vim.tbl_extend("force", setup_opts, opts or {})
  opts.mappings = vim.tbl_deep_extend("force", default_mappings, opts.mappings or {})
weeman1337 commented 2 years ago

Hey @Tej12345 thanks for raising this issue.

I thought about shortcuts and came to this conclusion:

weeman1337 commented 2 years ago

@Tej12345 can you give #30 a try? Will merge it after some testing.

gegoune commented 2 years ago

I, on the other hand, am against that breaking change. Ability to disable default mappings is a non-breaking change that requires nothing from majority of users which most of the time use default mappings set by plugins. Those unhappy with default one should be given an option to either override existing mappings one by one or get plugins not to set them in the first place.

weeman1337 commented 2 years ago

Everything except <C-k> will be removed. for sure <C-k> is a „basic“ shortcut.

About the final solution there is an ongoing discussion in #30

benwoodward commented 2 years ago

Everything except will be removed. for sure is a „basic“ shortcut.

I use <C-k> to move the file selection up when using rg, fzf etc.—would be great if I could override this built-in mapping.

matteha commented 2 years ago

Everything except will be removed. for sure is a „basic“ shortcut.

I use <C-k> to move the file selection up when using rg, fzf etc.—would be great if I could override this built-in mapping.

Same here, also using C-k to navigate popup menus. It's been recommended as keybinding for e.g. cmp autocomplete as well for a while. Great plugin, thanks!

weeman1337 commented 2 years ago

Hi @benwoodward , @matteha you can override/disable the default mappings as described in the configuration section. Just use default_mappings to change them.

weeman1337 commented 2 years ago

Also see this issue https://github.com/nvim-telescope/telescope-live-grep-args.nvim/issues/34

benwoodward commented 2 years ago

Hi @benwoodward , @matteha you can override/disable the default mappings as described in the configuration section. Just use default_mappings to change them.

fantastic. thank you. and thanks for putting this plugin together!

EDIT: realised that I was also placing telescope.load_extension("live_grep_args") before the telescope.setup rather than after