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:
Simon Hauser
2021-06-09 19:51:03 +02:00
committed by GitHub
parent feaed4b6e2
commit 618e0e6075
7 changed files with 202 additions and 42 deletions

View File

@@ -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 {}