From 9beaf84d2f2bdef8e0400db78c364806008226f2 Mon Sep 17 00:00:00 2001 From: Matthew Malcomson Date: Tue, 4 Apr 2017 14:28:20 +0100 Subject: Ensure :lmap mappings take preference If the mental model of :lmap mappings is a translation between your keyboard and vim proper, then they should take preference over :imap (and other) mappings. This patch makes that happen. --- src/nvim/getchar.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/nvim/getchar.c b/src/nvim/getchar.c index 458c79ad4e..d1a28ae3b0 100644 --- a/src/nvim/getchar.c +++ b/src/nvim/getchar.c @@ -1844,8 +1844,11 @@ static int vgetorpeek(int advance) keylen = KEYLEN_PART_MAP; break; } - } else if (keylen > mp_match_len) { - /* found a longer match */ + } else if (keylen > mp_match_len + || (keylen == mp_match_len + && (mp_match->m_mode & LANGMAP) == 0 + && (mp->m_mode & LANGMAP) != 0)) { + // found a longer match mp_match = mp; mp_match_len = keylen; } -- cgit