Add zero-indexed register
This commit is contained in:
parent
e488195ffa
commit
2693c8cc21
|
@ -205,6 +205,7 @@ constexpr StringView register_doc =
|
|||
"%: buffer name\n"
|
||||
".: selection contents\n"
|
||||
"#: selection index\n"
|
||||
"$: selection index (zero-indexed)\n"
|
||||
"_: null register\n"
|
||||
"\": default yank/paste register\n"
|
||||
"@: default macro register\n"
|
||||
|
|
11
src/main.cc
11
src/main.cc
|
@ -445,6 +445,17 @@ void register_registers()
|
|||
return res;
|
||||
}));
|
||||
|
||||
register_manager.add_register('$', make_dyn_reg(
|
||||
"$",
|
||||
[](const Context& context) {
|
||||
const size_t count = context.selections().size();
|
||||
StringList res;
|
||||
res.reserve(count);
|
||||
for (size_t i = 0; i < count; ++i)
|
||||
res.push_back(to_string((int)i));
|
||||
return res;
|
||||
}));
|
||||
|
||||
for (size_t i = 0; i < 10; ++i)
|
||||
{
|
||||
register_manager.add_register('0'+i, make_dyn_reg(
|
||||
|
|
|
@ -67,6 +67,7 @@ static const HashMap<StringView, Codepoint> reg_names {
|
|||
{ "percent", '%' },
|
||||
{ "dot", '.' },
|
||||
{ "hash", '#' },
|
||||
{ "dollar", '$' },
|
||||
{ "underscore", '_' },
|
||||
{ "colon", ':' }
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue
Block a user