diff --git a/doc/pages/commands.asciidoc b/doc/pages/commands.asciidoc index b35b5d82..285610aa 100644 --- a/doc/pages/commands.asciidoc +++ b/doc/pages/commands.asciidoc @@ -67,8 +67,9 @@ command *q!* has to be used). Aliases are mentionned below each commands. *rename-buffer* :: set current buffer name -*source* :: +*source* ...:: execute commands in + parameters are avilable in the sourced script through the `arg` values == Clients and Sessions diff --git a/src/commands.cc b/src/commands.cc index a63bc71a..d81be634 100644 --- a/src/commands.cc +++ b/src/commands.cc @@ -1284,8 +1284,8 @@ const CommandDesc debug_cmd = { const CommandDesc source_cmd = { "source", nullptr, - "source : execute commands contained in ", - single_param, + "source ...: execute commands contained in ", + ParameterDesc{ {}, ParameterDesc::Flags::None, 1, (size_t)-1 }, CommandFlags::None, CommandHelper{}, filename_completer, @@ -1299,8 +1299,9 @@ const CommandDesc source_cmd = { MappedFile file_content{path}; try { + auto params = parser | skip(1) | gather>(); CommandManager::instance().execute(file_content, context, - {{}, {{"source", path}}}); + {params, {{"source", path}}}); } catch (Kakoune::runtime_error& err) {