@@ -291,15 +291,19 @@ local function merge_mappings(user_mappings)
291291 for _ , map in pairs (user_mappings ) do
292292 if type (map .key ) == " table" then
293293 for _ , key in pairs (map .key ) do
294- table.insert (user_keys , key )
295- if is_empty (map .action ) then
296- table.insert (removed_keys , key )
294+ if type (key ) == " string" then
295+ table.insert (user_keys , key :lower ())
296+ if is_empty (map .action ) then
297+ table.insert (removed_keys , key :lower ())
298+ end
297299 end
298300 end
299301 else
300- table.insert (user_keys , map .key )
301- if is_empty (map .action ) then
302- table.insert (removed_keys , map .key )
302+ if type (map .key ) == " string" then
303+ table.insert (user_keys , map .key :lower ())
304+ if is_empty (map .action ) then
305+ table.insert (removed_keys , map .key :lower ())
306+ end
303307 end
304308 end
305309
@@ -316,14 +320,19 @@ local function merge_mappings(user_mappings)
316320 if type (map .key ) == " table" then
317321 local filtered_keys = {}
318322 for _ , key in pairs (map .key ) do
319- if not vim .tbl_contains (user_keys , key ) and not vim .tbl_contains (removed_keys , key ) then
323+ if
324+ type (key ) == " string"
325+ and not vim .tbl_contains (user_keys , key :lower ())
326+ and not vim .tbl_contains (removed_keys , key :lower ())
327+ then
320328 table.insert (filtered_keys , key )
321329 end
322330 end
323331 map .key = filtered_keys
324332 return not vim .tbl_isempty (map .key )
325333 else
326- return not vim .tbl_contains (user_keys , map .key ) and not vim .tbl_contains (removed_keys , map .key )
334+ return type (map .key ) ~= " string"
335+ or not vim .tbl_contains (user_keys , map .key :lower ()) and not vim .tbl_contains (removed_keys , map .key :lower ())
327336 end
328337 end , M .mappings )
329338
@@ -366,14 +375,17 @@ local function filter_mappings(mappings, keys)
366375 if type (keys ) == " boolean" and keys then
367376 return {}
368377 elseif type (keys ) == " table" then
378+ local keys_lower = vim .tbl_map (function (k )
379+ return type (k ) == " string" and k :lower () or nil
380+ end , keys )
369381 return vim .tbl_filter (function (m )
370382 if type (m .key ) == " table" then
371383 m .key = vim .tbl_filter (function (k )
372- return not vim .tbl_contains (keys , k )
384+ return type ( k ) ~= " string " or not vim .tbl_contains (keys_lower , k : lower () )
373385 end , m .key )
374386 return # m .key > 0
375387 else
376- return not vim .tbl_contains (keys , m .key )
388+ return type ( m . key ) ~= " string " or not vim .tbl_contains (keys_lower , m .key : lower () )
377389 end
378390 end , vim .deepcopy (mappings ))
379391 else
0 commit comments