diff options
| author | runiq <patrice.peterson@mailbox.org> | 2020-09-07 04:51:36 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-09-06 22:51:36 -0400 |
| commit | 675e240383454e96f0275062b1a67f8b55cc2798 (patch) | |
| tree | b95382e51d7a7ab99bc11c782bbf704b72ace2bb /lua/telescope | |
| parent | b065423013c35112f00154b575900482738ec7ef (diff) | |
Normalize mappings (#28)
Modes now use lowercase keys, mappings use the internal representation
via `nvim_replace_termcodes()`.
Diffstat (limited to 'lua/telescope')
| -rw-r--r-- | lua/telescope/mappings.lua | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lua/telescope/mappings.lua b/lua/telescope/mappings.lua index 48d5606..8d9dd65 100644 --- a/lua/telescope/mappings.lua +++ b/lua/telescope/mappings.lua @@ -98,7 +98,9 @@ mappings.apply_keymap = function(prompt_bufnr, attach_mappings, buffer_keymap) local applied_mappings = { n = {}, i = {} } local map = function(mode, key_bind, key_func, opts) - applied_mappings[mode][key_bind] = true + local 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) end @@ -108,11 +110,13 @@ mappings.apply_keymap = function(prompt_bufnr, attach_mappings, buffer_keymap) end for mode, mode_map in pairs(buffer_keymap) do + local mode = string.lower(mode) -- TODO: Probalby should not overwrite any keymaps -- local buffer_keymaps for key_bind, key_func in pairs(mode_map) do - if not applied_mappings[mode][key_bind] then + local key_bind_internal = a.nvim_replace_termcodes(key_bind, true, true, true) + if not applied_mappings[mode][key_bind_internal] then telescope_map(prompt_bufnr, mode, key_bind, key_func) end end |
