diff options
| author | Maxime Coste <frrrwww@gmail.com> | 2013-10-11 00:31:03 +0100 |
|---|---|---|
| committer | Maxime Coste <frrrwww@gmail.com> | 2013-10-11 00:31:03 +0100 |
| commit | 632e7e217e26eecce5b521e65cde265d08b3db87 (patch) | |
| tree | 0703eaec9f5529b69302ebc34c2242d234587338 /src/normal.cc | |
| parent | 3c959cee997d5006ba25e3c8165c96ddb7a4b16b (diff) | |
Save last pipe command to the '|' register, and use it for empty cmd
Diffstat (limited to 'src/normal.cc')
| -rw-r--r-- | src/normal.cc | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/normal.cc b/src/normal.cc index 0ccdba11..911ec90a 100644 --- a/src/normal.cc +++ b/src/normal.cc @@ -264,6 +264,18 @@ void pipe(Context& context, int) if (event != PromptEvent::Validate) return; + String real_cmd; + if (cmdline.empty()) + real_cmd = RegisterManager::instance()['|'].values(context)[0]; + else + { + RegisterManager::instance()['|'] = cmdline; + real_cmd = cmdline; + } + + if (real_cmd.empty()) + return; + Editor& editor = context.editor(); std::vector<String> strings; for (auto& sel : context.editor().selections()) @@ -272,7 +284,7 @@ void pipe(Context& context, int) bool insert_eol = str.back() != '\n'; if (insert_eol) str += '\n'; - str = ShellManager::instance().pipe(str, cmdline, context, + str = ShellManager::instance().pipe(str, real_cmd, context, {}, EnvVarMap{}); if (insert_eol and str.back() == '\n') str = str.substr(0, str.length()-1); |
