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.
This commit is contained in:
Thomas Vigouroux
2021-08-17 15:56:37 +02:00
committed by Axel Dahlberg
parent b1757e1c29
commit 8a4e26c6fe
13 changed files with 131 additions and 21 deletions

View File

@@ -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();
}
}