From 061307233cdff0a90504117dd48e4fec3a10443a Mon Sep 17 00:00:00 2001 From: TJ DeVries Date: Wed, 2 Sep 2020 00:06:03 -0400 Subject: feat: add some new items and make mappings easier --- lua/telescope/pickers.lua | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'lua/telescope/pickers.lua') 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', '', 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 -- cgit v1.2.3