diff --git a/src/nvim/mapping.c b/src/nvim/mapping.c index ce4c0586e3..3840a00981 100644 --- a/src/nvim/mapping.c +++ b/src/nvim/mapping.c @@ -1342,7 +1342,7 @@ int ExpandMappings(char *pat, regmatch_T *regmatch, int *numMatches, char ***mat mp = maphash[hash]; } for (; mp; mp = mp->m_next) { - if (!(mp->m_mode & expand_mapmodes)) { + if (mp->m_simplified || !(mp->m_mode & expand_mapmodes)) { continue; } diff --git a/src/nvim/testdir/test_mapping.vim b/src/nvim/testdir/test_mapping.vim index 6cf19306ec..e25c3c333e 100644 --- a/src/nvim/testdir/test_mapping.vim +++ b/src/nvim/testdir/test_mapping.vim @@ -759,11 +759,12 @@ func Test_mapcomplete() call feedkeys(":abbr! \\\"\", 'tx') call assert_equal("\"abbr! \x01", @:) - " Multiple matches for a map - nmap ,f /H - omap ,f /H + " When multiple matches have the same {lhs}, it should only appear once. + " The simplified form should also not be included. + nmap , /H + omap , /H call feedkeys(":map ,\\\"\", 'tx') - call assert_equal('"map ,f', @:) + call assert_equal('"map ,', @:) mapclear endfunc