add 'r' for replacing selection with next typed char

This commit is contained in:
Maxime Coste 2012-09-11 14:01:41 +02:00
parent 9664ce5f89
commit b5a2901f8d

View File

@ -86,6 +86,13 @@ void do_go(Context& context)
});
}
void do_replace_with_char(Context& context)
{
context.client().on_next_key([](const Key& key, Context& context) {
context.editor().replace(String() + key.key);
});
}
void do_command(Context& context)
{
context.client().prompt(
@ -353,6 +360,7 @@ std::unordered_map<Key, std::function<void (Context& context)>> keymap =
{ { Key::Modifiers::None, 'A' }, do_insert<IncrementalInserter::Mode::AppendAtLineEnd> },
{ { Key::Modifiers::None, 'o' }, do_insert<IncrementalInserter::Mode::OpenLineBelow> },
{ { Key::Modifiers::None, 'O' }, do_insert<IncrementalInserter::Mode::OpenLineAbove> },
{ { Key::Modifiers::None, 'r' }, do_replace_with_char },
{ { Key::Modifiers::None, 'g' }, do_go<SelectMode::Replace> },
{ { Key::Modifiers::None, 'G' }, do_go<SelectMode::Extend> },