summaryrefslogtreecommitdiff
path: root/src/normal.cc
diff options
context:
space:
mode:
authorMaxime Coste <frrrwww@gmail.com>2015-11-17 23:47:59 +0000
committerMaxime Coste <frrrwww@gmail.com>2015-11-17 23:47:59 +0000
commita37858ece7a2e01cc2c512fd0818c541bea5ce5b (patch)
tree6785925b3347e5b6ae73e548f0bda5ca73bcb8f4 /src/normal.cc
parent6bd71c68e5548334e655a8c391843314a25f7894 (diff)
Put count and register normal mode params in the shell context
'10:echo %val{count}' will display 10 Fixes #10
Diffstat (limited to 'src/normal.cc')
-rw-r--r--src/normal.cc13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/normal.cc b/src/normal.cc
index 8a3da241..bee88b98 100644
--- a/src/normal.cc
+++ b/src/normal.cc
@@ -334,7 +334,7 @@ void for_each_codepoint(Context& context, NormalParams)
selections.insert(strings, InsertMode::Replace);
}
-void command(Context& context, NormalParams)
+void command(Context& context, NormalParams params)
{
if (not CommandManager::has_instance())
return;
@@ -345,7 +345,7 @@ void command(Context& context, NormalParams)
StringView cmd_line, ByteCount pos) {
return CommandManager::instance().complete(context, flags, cmd_line, pos);
},
- [](StringView cmdline, PromptEvent event, Context& context) {
+ [params](StringView cmdline, PromptEvent event, Context& context) {
if (context.has_ui())
{
context.ui().info_hide();
@@ -362,7 +362,14 @@ void command(Context& context, NormalParams)
}
}
if (event == PromptEvent::Validate)
- CommandManager::instance().execute(cmdline, context);
+ {
+ EnvVarMap env_vars = {
+ { "count", to_string(params.count) },
+ { "register", String{params.reg} }
+ };
+ CommandManager::instance().execute(
+ cmdline, context, { {}, env_vars });
+ }
});
}