aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/ops.c
diff options
context:
space:
mode:
authorThomas Vigouroux <tomvig38@gmail.com>2021-08-17 15:56:37 +0200
committerAxel Dahlberg <git@valleymnt.com>2021-12-18 10:54:26 +0100
commit8a4e26c6fe7530a0e24268cd373f0d4e53fe81e1 (patch)
tree9b3178c7db16ab4e06327774cb5d47185f23f6cc /src/nvim/ops.c
parentb1757e1c29d07c7958c62427e19e85916670049d (diff)
downloadrneovim-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/ops.c')
-rw-r--r--src/nvim/ops.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/src/nvim/ops.c b/src/nvim/ops.c
index 9bc63477e9..c6f9c5f04f 100644
--- a/src/nvim/ops.c
+++ b/src/nvim/ops.c
@@ -912,13 +912,14 @@ int do_record(int c)
showmode();
regname = c;
retval = OK;
- }
- } else { // stop recording
- /*
- * Get the recorded key hits. K_SPECIAL and CSI will be escaped, this
- * needs to be removed again to put it in a register. exec_reg then
- * adds the escaping back later.
- */
+ apply_autocmds(EVENT_RECORDINGENTER, NULL, NULL, false, curbuf);
+ }
+ } else { // stop recording
+ // Get the recorded key hits. K_SPECIAL and CSI will be escaped, this
+ // needs to be removed again to put it in a register. exec_reg then
+ // adds the escaping back later.
+ apply_autocmds(EVENT_RECORDINGLEAVE, NULL, NULL, false, curbuf);
+ reg_recorded = reg_recording;
reg_recording = 0;
if (ui_has(kUIMessages)) {
showmode();
@@ -932,10 +933,8 @@ int do_record(int c)
// Remove escaping for CSI and K_SPECIAL in multi-byte chars.
vim_unescape_csi(p);
- /*
- * We don't want to change the default register here, so save and
- * restore the current register name.
- */
+ // We don't want to change the default register here, so save and
+ // restore the current register name.
old_y_previous = y_previous;
retval = stuff_yank(regname, p);