feat: set defaults for each picker in telescope setup (#883)
This allows easier picker configuration for example:
```lua
require("telescope").setup {
pickers = {
buffers = {
show_all_buffers = true,
sort_lastused = true,
theme = "dropdown",
previewer = false,
mappings = {
i = {
["<c-q>"] = "smart_send_to_qflist",
}
}
}
}
}
```
This configuration will be applied when running `:Telescope buffers`
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
-- Keep the values around between reloads
|
||||
_TelescopeConfigurationValues = _TelescopeConfigurationValues or {}
|
||||
_TelescopeConfigurationPickers = _TelescopeConfigurationPickers or {}
|
||||
|
||||
local function first_non_null(...)
|
||||
local n = select('#', ...)
|
||||
@@ -45,6 +46,15 @@ local config = {}
|
||||
|
||||
config.values = _TelescopeConfigurationValues
|
||||
config.descriptions = {}
|
||||
config.pickers = _TelescopeConfigurationPickers
|
||||
|
||||
function config.set_pickers(pickers)
|
||||
pickers = pickers or {}
|
||||
|
||||
for k, v in pairs(pickers) do
|
||||
config.pickers[k] = v
|
||||
end
|
||||
end
|
||||
|
||||
function config.set_defaults(defaults)
|
||||
defaults = defaults or {}
|
||||
|
||||
Reference in New Issue
Block a user