@@ -291,15 +291,19 @@ local function merge_mappings(user_mappings)
291
291
for _ , map in pairs (user_mappings ) do
292
292
if type (map .key ) == " table" then
293
293
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
297
299
end
298
300
end
299
301
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
303
307
end
304
308
end
305
309
@@ -316,14 +320,19 @@ local function merge_mappings(user_mappings)
316
320
if type (map .key ) == " table" then
317
321
local filtered_keys = {}
318
322
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
320
328
table.insert (filtered_keys , key )
321
329
end
322
330
end
323
331
map .key = filtered_keys
324
332
return not vim .tbl_isempty (map .key )
325
333
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 ())
327
336
end
328
337
end , M .mappings )
329
338
@@ -366,14 +375,17 @@ local function filter_mappings(mappings, keys)
366
375
if type (keys ) == " boolean" and keys then
367
376
return {}
368
377
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 )
369
381
return vim .tbl_filter (function (m )
370
382
if type (m .key ) == " table" then
371
383
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 () )
373
385
end , m .key )
374
386
return # m .key > 0
375
387
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 () )
377
389
end
378
390
end , vim .deepcopy (mappings ))
379
391
else
0 commit comments