@@ -1328,15 +1328,21 @@ H.map_buf_triggers = function(buf_id)
13281328 if not H .is_valid_buf (buf_id ) or H .is_disabled (buf_id ) then return end
13291329
13301330 for _ , trigger in ipairs (H .get_config (nil , buf_id ).triggers ) do
1331- H .map_trigger (buf_id , trigger )
1331+ local modes = type (trigger .mode ) == ' table' and trigger .mode or { trigger .mode }
1332+ for _ , mode in ipairs (modes ) do
1333+ H .map_trigger (buf_id , { mode = mode , keys = trigger .keys })
1334+ end
13321335 end
13331336end
13341337
13351338H .unmap_buf_triggers = function (buf_id )
13361339 if not H .is_valid_buf (buf_id ) or H .is_disabled (buf_id ) then return end
13371340
13381341 for _ , trigger in ipairs (H .get_config (nil , buf_id ).triggers ) do
1339- H .unmap_trigger (buf_id , trigger )
1342+ local modes = type (trigger .mode ) == ' table' and trigger .mode or { trigger .mode }
1343+ for _ , mode in ipairs (modes ) do
1344+ H .unmap_trigger (buf_id , { mode = mode , keys = trigger .keys })
1345+ end
13401346 end
13411347end
13421348
@@ -1780,7 +1786,8 @@ H.clues_get_all = function(mode)
17801786
17811787 -- Order of clue precedence: config clues < buffer mappings < global mappings
17821788 local config_clues = H .clues_normalize (H .get_config ().clues ) or {}
1783- local mode_clues = vim .tbl_filter (function (x ) return x .mode == mode end , config_clues )
1789+ local mode_filter = function (x ) return type (x .mode ) == ' table' and vim .list_contains (x .mode , mode ) or x .mode == mode end
1790+ local mode_clues = vim .tbl_filter (mode_filter , config_clues )
17841791 for _ , clue in ipairs (mode_clues ) do
17851792 local lhsraw = H .replace_termcodes (clue .keys )
17861793
@@ -1953,7 +1960,7 @@ H.is_trigger = function(x) return type(x) == 'table' and type(x.mode) == 'string
19531960
19541961H .is_clue = function (x )
19551962 if type (x ) ~= ' table' then return false end
1956- local mandatory = type (x .mode ) == ' string' and type (x .keys ) == ' string'
1963+ local mandatory = ( type (x .mode ) == ' string' or type ( x . mode ) == ' table ' ) and type (x .keys ) == ' string'
19571964 local extra = (x .desc == nil or type (x .desc ) == ' string' or vim .is_callable (x .desc ))
19581965 and (x .postkeys == nil or type (x .postkeys ) == ' string' )
19591966 return mandatory and extra
0 commit comments