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

@@ -828,6 +828,14 @@ RemoteReply When a reply from a Vim that functions as
SearchWrapped After making a search with |n| or |N| if the
search wraps around the document back to
the start/finish respectively.
*RecordingEnter*
RecordingEnter When a macro starts to be recorded.
The pattern is the current file name, and
|reg_recording()| is the current register that
is used.
*RecordinLeave*
RecordingLeave When the is the end of a macro recording.
The pattern is the current file name.
*SessionLoadPost*
SessionLoadPost After loading the session file created using
the |:mksession| command.

View File

@@ -2588,6 +2588,7 @@ readdir({dir} [, {expr}]) List file names in {dir} selected by {expr}
readfile({fname} [, {type} [, {max}]])
List get list of lines from file {fname}
reg_executing() String get the executing register name
reg_recorded() String get the last recorded register name
reg_recording() String get the recording register name
reltime([{start} [, {end}]]) List get time value
reltimefloat({time}) Float turn the time value into a Float
@@ -7825,6 +7826,11 @@ reg_executing() *reg_executing()*
Returns an empty string when no register is being executed.
See |@|.
reg_recorded() *reg_recorded()*
Returns the single letter name of the last recorded register.
Returns an empty string string when nothing was recorded yet.
See |q|.
reg_recording() *reg_recording()*
Returns the single letter name of the register being recorded.
Returns an empty string string when not recording. See |q|.

View File

@@ -563,8 +563,8 @@ The command CTRL-\ CTRL-G or <C-\><C-G> can be used to go to Insert mode when
make sure Vim is in the mode indicated by 'insertmode', without knowing in
what mode Vim currently is.
*gQ* *Q* *mode-Ex* *Ex-mode* *Ex* *EX* *E501*
Q or gQ Switch to Ex mode. This is like typing ":" commands
*gQ* *mode-Ex* *Ex-mode* *Ex* *EX* *E501*
gQ Switch to Ex mode. This is like typing ":" commands
one after another, except:
- You don't have to keep pressing ":".
- The screen doesn't get updated after each command.

View File

@@ -147,6 +147,9 @@ q Stops recording.
*@@* *E748*
@@ Repeat the previous @{0-9a-z":*} [count] times.
*Q*
Q Repeat the last recorded register [count] times.
*:@*
:[addr]@{0-9a-z".=*+} Execute the contents of register {0-9a-z".=*+} as an Ex
command. First set cursor at line [addr] (default is

View File

@@ -218,6 +218,7 @@ Input/Mappings:
Normal commands:
|gO| shows a filetype-defined "outline" of the current buffer.
|Q| replays the last recorded macro.
Options:
'cpoptions' flags: |cpo-_|