Skip to content

Commit 84626df

Browse files
committed
add recording_register value expansion
1 parent 091a66a commit 84626df

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

doc/pages/expansions.asciidoc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,9 @@ The following expansions are supported (with required context _in italics_):
334334
an inner selection, `to_begin` if the user wants to select to the
335335
beginning, and `to_end` if the user wants to select to the end
336336

337+
*%val{recording_register}*::
338+
the register being recorded to if currently recording a macro, empty when not recording
339+
337340
*%val{register}*::
338341
_in `map` command <keys> parameter and `<a-;>` from the object menu_ +
339342
current register when the mapping was triggered

src/main.cc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,11 @@ const EnvVarDesc builtin_env_vars[] = { {
257257
[](StringView name, const Context& context) -> Vector<String>
258258
{ auto cursor = context.selections().main().cursor();
259259
return {to_string(context.buffer().distance({0,0}, cursor))}; }
260+
}, {
261+
"recording_register", false,
262+
[](StringView name, const Context& context) -> Vector<String>
263+
{ const char reg = context.client().input_handler().recording_reg();
264+
return {reg ? String{static_cast<Codepoint>(reg)} : ""}; }
260265
}, {
261266
"selection_desc", false,
262267
[](StringView name, const Context& context) -> Vector<String>

0 commit comments

Comments
 (0)