diff options
author | Thomas Vigouroux <tomvig38@gmail.com> | 2021-08-17 15:56:37 +0200 |
---|---|---|
committer | Axel Dahlberg <git@valleymnt.com> | 2021-12-18 10:54:26 +0100 |
commit | 8a4e26c6fe7530a0e24268cd373f0d4e53fe81e1 (patch) | |
tree | 9b3178c7db16ab4e06327774cb5d47185f23f6cc /src/nvim/normal.c | |
parent | b1757e1c29d07c7958c62427e19e85916670049d (diff) | |
download | rneovim-8a4e26c6fe7530a0e24268cd373f0d4e53fe81e1.tar.gz rneovim-8a4e26c6fe7530a0e24268cd373f0d4e53fe81e1.tar.bz2 rneovim-8a4e26c6fe7530a0e24268cd373f0d4e53fe81e1.zip |
feat(autocmd): add Recording autocmds
feat(eval): add reg_recorded()
This function is used the get the last recorded register.
style(Recording): rename handler to match suggestions
fix(RecordingLeave): send autocommand earlier
This makes the autocommand fire just before setting reg_recorded to
reg_recording, this way we clearly show that we are actually just before
actually quitting the recording mode.
Diffstat (limited to 'src/nvim/normal.c')
-rw-r--r-- | src/nvim/normal.c | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/src/nvim/normal.c b/src/nvim/normal.c index 95a521c0d8..3246596f16 100644 --- a/src/nvim/normal.c +++ b/src/nvim/normal.c @@ -229,7 +229,7 @@ static const struct nv_cmd { { 'N', nv_next, 0, SEARCH_REV }, { 'O', nv_open, 0, 0 }, { 'P', nv_put, 0, 0 }, - { 'Q', nv_exmode, NV_NCW, 0 }, + { 'Q', nv_regreplay, 0, 0 }, { 'R', nv_Replace, 0, false }, { 'S', nv_subst, NV_KEEPREG, 0 }, { 'T', nv_csearch, NV_NCH_ALW|NV_LANG, BACKWARD }, @@ -4028,15 +4028,18 @@ dozet: /* * "Q" command. */ -static void nv_exmode(cmdarg_T *cap) +static void nv_regreplay(cmdarg_T *cap) { - /* - * Ignore 'Q' in Visual mode, just give a beep. - */ - if (VIsual_active) { - vim_beep(BO_EX); - } else if (!checkclearop(cap->oap)) { - do_exmode(); + if (checkclearop(cap->oap)) { + return; + } + + while (cap->count1-- && !got_int) { + if (do_execreg(reg_recorded, false, false, false) == false) { + clearopbeep(cap->oap); + break; + } + line_breakcheck(); } } |