summaryrefslogtreecommitdiffstats
path: root/src/getchar.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2022-03-03 13:56:24 +0000
committerBram Moolenaar <Bram@vim.org>2022-03-03 13:56:24 +0000
commit1fc34225acbee5ddca2b9ec3f82b3014d385b7f8 (patch)
treefb70c61fa811d9acbbddfc40fed5d54d79208df7 /src/getchar.c
parent35d8c2010ea6ee5c9bcfa6a8285648172b92ed83 (diff)
patch 8.2.4498: using <Plug> with "noremap" does not workv8.2.4498
Problem: Using <Plug> with "noremap" does not work. Solution: Always remap <Plug>. (closes #9879, closes #9789)
Diffstat (limited to 'src/getchar.c')
-rw-r--r--src/getchar.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/getchar.c b/src/getchar.c
index fcc9b9ac42..9939bbdbcb 100644
--- a/src/getchar.c
+++ b/src/getchar.c
@@ -2424,6 +2424,13 @@ handle_mapping(
int keylen = *keylenp;
int i;
int local_State = get_real_state();
+ int is_plug_map = FALSE;
+
+ // If typehead starts with <Plug> then remap, even for a "noremap" mapping.
+ if (typebuf.tb_buf[typebuf.tb_off] == K_SPECIAL
+ && typebuf.tb_buf[typebuf.tb_off + 1] == KS_EXTRA
+ && typebuf.tb_buf[typebuf.tb_off + 2] == KE_PLUG)
+ is_plug_map = TRUE;
/*
* Check for a mappable key sequence.
@@ -2441,7 +2448,7 @@ handle_mapping(
tb_c1 = typebuf.tb_buf[typebuf.tb_off];
if (no_mapping == 0 && is_maphash_valid()
&& (no_zero_mapping == 0 || tb_c1 != '0')
- && (typebuf.tb_maplen == 0
+ && (typebuf.tb_maplen == 0 || is_plug_map
|| (p_remap
&& (typebuf.tb_noremap[typebuf.tb_off]
& (RM_NONE|RM_ABBR)) == 0))
@@ -2562,7 +2569,7 @@ handle_mapping(
for (n = mlen; --n >= 0; )
if (*s++ & (RM_NONE|RM_ABBR))
break;
- if (n >= 0)
+ if (!is_plug_map && n >= 0)
continue;
if (keylen > typebuf.tb_len)