Change # register to contain selection number

Using <c-r># in insert will allow easy numbering
This commit is contained in:
Maxime Coste 2014-05-23 20:27:35 +01:00
parent 152e46a6da
commit f08966197e

View File

@ -163,7 +163,12 @@ void register_registers()
} dyn_regs[] = { } dyn_regs[] = {
{ '%', [](const Context& context) { return StringList{{context.buffer().display_name()}}; } }, { '%', [](const Context& context) { return StringList{{context.buffer().display_name()}}; } },
{ '.', [](const Context& context) { return context.selections_content(); } }, { '.', [](const Context& context) { return context.selections_content(); } },
{ '#', [](const Context& context) { return StringList{{to_string((int)context.selections().size())}}; } }, { '#', [](const Context& context) {
StringList res;
for (size_t i = 1; i < context.selections().size(); ++i)
res.push_back(to_string((int)i));
return res;
} }
}; };
RegisterManager& register_manager = RegisterManager::instance(); RegisterManager& register_manager = RegisterManager::instance();