diff --git a/lua/telescope/config.lua b/lua/telescope/config.lua index 716141664c..bce6bacd93 100644 --- a/lua/telescope/config.lua +++ b/lua/telescope/config.lua @@ -727,6 +727,15 @@ append( }]] ) +append( + "attach_mappings", + nil, + [[ + Defines the `attach_mappings` function that will be used as default for all pickers + If you define `attach_mappings` on specific picker, that'll be used instead. + Default: nil ]] +) + append( "use_less", true, diff --git a/lua/telescope/pickers.lua b/lua/telescope/pickers.lua index 462355aefb..d105b4a8e3 100644 --- a/lua/telescope/pickers.lua +++ b/lua/telescope/pickers.lua @@ -1535,8 +1535,10 @@ end ---@return Picker pickers.new = function(opts, defaults) opts = opts or {} + opts.attach_mappings = opts.attach_mappings or config.values.attach_mappings defaults = defaults or {} local result = {} + -- Inspect(opts) for k, v in pairs(opts) do assert(type(k) == "string" or type(k) == "number", "Should be string or number, found: " .. type(k))