summaryrefslogtreecommitdiff
path: root/lua/telescope/pickers.lua
diff options
context:
space:
mode:
authorTJ DeVries <devries.timothyj@gmail.com>2020-09-02 00:06:03 -0400
committerTJ DeVries <devries.timothyj@gmail.com>2020-09-02 00:06:07 -0400
commit061307233cdff0a90504117dd48e4fec3a10443a (patch)
treed71cd84a3eb93fda55284b22be3eb610aaced13a /lua/telescope/pickers.lua
parent9f906f03922907b95b71a8f57254e64ba9c76ce8 (diff)
feat: add some new items and make mappings easier
Diffstat (limited to 'lua/telescope/pickers.lua')
-rw-r--r--lua/telescope/pickers.lua18
1 files changed, 15 insertions, 3 deletions
diff --git a/lua/telescope/pickers.lua b/lua/telescope/pickers.lua
index 4b450f2..51b1162 100644
--- a/lua/telescope/pickers.lua
+++ b/lua/telescope/pickers.lua
@@ -14,7 +14,7 @@ local get_default = utils.get_default
-- TODO: Make this work with deep extend I think.
local extend = function(opts, defaults)
- local result = vim.deepcopy(opts or {})
+ local result = opts or {}
for k, v in pairs(defaults or {}) do
if result[k] == nil then
result[k] = v
@@ -69,7 +69,19 @@ function Picker:new(opts)
sorter = opts.sorter,
previewer = opts.previewer,
- mappings = get_default(opts.mappings, default_mappings),
+ -- opts.mappings => overwrites entire table
+ -- opts.override_mappings => merges your table in with defaults.
+ -- Add option to change default
+ -- opts.attach(bufnr)
+
+ --[[
+ function(map)
+ map('n', '<esc>', actions.close, [opts])
+ telescope.apply_mapping
+ end
+ --]]
+ -- mappings = get_default(opts.mappings, default_mappings),
+ attach_mappings = opts.attach_mappings,
get_window_options = opts.get_window_options,
selection_strategy = opts.selection_strategy,
@@ -366,7 +378,7 @@ function Picker:find()
finder = finder,
})
- mappings.apply_keymap(prompt_bufnr, self.mappings)
+ mappings.apply_keymap(prompt_bufnr, self.attach_mappings, default_mappings)
vim.cmd [[startinsert]]
end