From d541e0d6e00a0d89f21e1b0e6fe92c736ac0f83b Mon Sep 17 00:00:00 2001 From: ADoyle Date: Mon, 7 Nov 2022 00:42:29 +0800 Subject: feat: the parameter "map" of attach_mappings can be list of modes to create mapping on multiple modes (#2220) --- lua/telescope/builtin/__internal.lua | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) (limited to 'lua/telescope/builtin/__internal.lua') diff --git a/lua/telescope/builtin/__internal.lua b/lua/telescope/builtin/__internal.lua index 3684518..9b6931d 100644 --- a/lua/telescope/builtin/__internal.lua +++ b/lua/telescope/builtin/__internal.lua @@ -198,8 +198,7 @@ internal.pickers = function(opts) opts["initial_mode"] = cached_pickers[selection_index].initial_mode internal.resume(opts) end) - map("i", "", actions.remove_selected_picker) - map("n", "", actions.remove_selected_picker) + map({ "i", "n" }, "", actions.remove_selected_picker) return true end, }) @@ -556,10 +555,8 @@ internal.command_history = function(opts) sorter = conf.generic_sorter(opts), attach_mappings = function(_, map) - map("i", "", actions.set_command_line) - map("n", "", actions.set_command_line) - map("n", "", actions.edit_command_line) - map("i", "", actions.edit_command_line) + map({ "i", "n" }, "", actions.set_command_line) + map({ "i", "n" }, "", actions.edit_command_line) -- TODO: Find a way to insert the text... it seems hard. -- map('i', '', actions.insert_value, { expr = true }) @@ -588,10 +585,8 @@ internal.search_history = function(opts) sorter = conf.generic_sorter(opts), attach_mappings = function(_, map) - map("i", "", actions.set_search_line) - map("n", "", actions.set_search_line) - map("n", "", actions.edit_search_line) - map("i", "", actions.edit_search_line) + map({ "i", "n" }, "", actions.set_search_line) + map({ "i", "n" }, "", actions.edit_search_line) -- TODO: Find a way to insert the text... it seems hard. -- map('i', '', actions.insert_value, { expr = true }) @@ -1091,7 +1086,7 @@ internal.registers = function(opts) sorter = conf.generic_sorter(opts), attach_mappings = function(_, map) actions.select_default:replace(actions.paste_register) - map("i", "", actions.edit_register) + map({ "i", "n" }, "", actions.edit_register) return true end, -- cgit v1.2.3