aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Malcomson <hardenedapple@gmail.com>2017-04-04 14:28:20 +0100
committerMatthew Malcomson <hardenedapple@gmail.com>2018-03-14 10:39:14 +0000
commit9beaf84d2f2bdef8e0400db78c364806008226f2 (patch)
treeab666826fcb0945dce04b1bf259c7b27434dd868
parent8e71a26e1931e8e87e6db6e13b77dadd488790de (diff)
downloadrneovim-9beaf84d2f2bdef8e0400db78c364806008226f2.tar.gz
rneovim-9beaf84d2f2bdef8e0400db78c364806008226f2.tar.bz2
rneovim-9beaf84d2f2bdef8e0400db78c364806008226f2.zip
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.
-rw-r--r--src/nvim/getchar.c7
1 files changed, 5 insertions, 2 deletions
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;
}