diff --git a/README.asciidoc b/README.asciidoc index 4e80e35f..eb02201b 100644 --- a/README.asciidoc +++ b/README.asciidoc @@ -630,8 +630,7 @@ Supported types are: * `val`: value expansion, gives access to the environment variable available to the Shell expansion. The `kak_` prefix is not used there. * `arg`: argument expansion, gives access to the arguments of the current - command, the content can be a number, or `#` for the argument count, - or `@` for all arguments concatenated. + command, the content can be a number, or `@` for all arguments. for example you can display last search pattern with diff --git a/src/command_manager.cc b/src/command_manager.cc index cd711c87..d5ccdeb7 100644 --- a/src/command_manager.cc +++ b/src/command_manager.cc @@ -348,17 +348,14 @@ String expand_token(const Token& token, const Context& context, } case Token::Type::ArgExpand: { - if (content == "#") - return to_string(shell_context.params.size()); - else if (content == "@") - return join(shell_context.params, ' '); + auto& params = shell_context.params; + if (content == '@') + return join(params, ' '); const int arg = str_to_int(content)-1; if (arg < 0) throw runtime_error("invalid argument index"); - if (arg < shell_context.params.size()) - return shell_context.params[arg]; - return {}; + return arg < params.size() ? params[arg] : String{}; } case Token::Type::RawEval: return expand(content, context, shell_context);