diff options
author | shadmansaleh <13149513+shadmansaleh@users.noreply.github.com> | 2022-01-07 17:28:14 +0600 |
---|---|---|
committer | shadmansaleh <13149513+shadmansaleh@users.noreply.github.com> | 2022-02-27 08:21:21 +0600 |
commit | 0347875a5c11258ebb6377a1ab79b04fe9c55bc9 (patch) | |
tree | 695e136b1f68b72cf3244ed424e340e41acf51b4 /src | |
parent | 84812bcc2c5577d387ab59048bf18ad443bdf79b (diff) | |
download | rneovim-0347875a5c11258ebb6377a1ab79b04fe9c55bc9.tar.gz rneovim-0347875a5c11258ebb6377a1ab79b04fe9c55bc9.tar.bz2 rneovim-0347875a5c11258ebb6377a1ab79b04fe9c55bc9.zip |
feat: ignore nore on <Plug> maps
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/getchar.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/nvim/getchar.c b/src/nvim/getchar.c index 34cde9a7c4..5b181da50e 100644 --- a/src/nvim/getchar.c +++ b/src/nvim/getchar.c @@ -1710,6 +1710,15 @@ static int handle_mapping(int *keylenp, bool *timedout, int *mapdepth) int keylen = *keylenp; int i; int local_State = get_real_state(); + bool is_plug_map = false; + + // Check if typehead starts with a <Plug> mapping. + // In that case we will ignore nore flag on it. + 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. // Walk through one maphash[] list until we find an entry that matches. @@ -1725,7 +1734,7 @@ static int handle_mapping(int *keylenp, bool *timedout, int *mapdepth) tb_c1 = typebuf.tb_buf[typebuf.tb_off]; if (no_mapping == 0 && 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)))) && !(p_paste && (State & (INSERT + CMDLINE))) @@ -1813,7 +1822,7 @@ static int handle_mapping(int *keylenp, bool *timedout, int *mapdepth) break; } } - if (n >= 0) { + if (!is_plug_map && n >= 0) { continue; } |