diff options
Diffstat (limited to 'lua/telescope/mappings.lua')
| -rw-r--r-- | lua/telescope/mappings.lua | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/lua/telescope/mappings.lua b/lua/telescope/mappings.lua index e5b23bc..45fad81 100644 --- a/lua/telescope/mappings.lua +++ b/lua/telescope/mappings.lua @@ -112,6 +112,11 @@ --- map("i", "asdf", function(_prompt_bufnr) --- print "You typed asdf" --- end) +--- +--- map({"i", "n"}, "<C-r>", function(_prompt_bufnr) +--- print "You typed <C-r>" +--- end) +--- --- -- needs to return true if you want to map default_mappings and --- -- false if not --- return true @@ -284,12 +289,18 @@ end mappings.apply_keymap = function(prompt_bufnr, attach_mappings, buffer_keymap) local applied_mappings = { n = {}, i = {} } - local map = function(mode, key_bind, key_func, opts) - mode = string.lower(mode) - local key_bind_internal = a.nvim_replace_termcodes(key_bind, true, true, true) - applied_mappings[mode][key_bind_internal] = true + local map = function(modes, key_bind, key_func, opts) + if type(modes) == "string" then + modes = { modes } + end + + for _, mode in pairs(modes) do + mode = string.lower(mode) + local key_bind_internal = a.nvim_replace_termcodes(key_bind, true, true, true) + applied_mappings[mode][key_bind_internal] = true - telescope_map(prompt_bufnr, mode, key_bind, key_func, opts) + telescope_map(prompt_bufnr, mode, key_bind, key_func, opts) + end end if attach_mappings then |
