function()

function

Start recording a function for later invocation as a command:

function(<name> [arg1 [arg2 [arg3 ...]]])
  COMMAND1(ARGS ...)
  COMMAND2(ARGS ...)
  ...
endfunction(<name>)

Define a function named <name> that takes arguments named arg1, arg2, arg3, (...). Commands listed after function, but before the matching endfunction(), are not invoked until the function is invoked. When it is invoked, the commands recorded in the function are first modified by replacing formal parameters (${arg1}) with the arguments passed, and then invoked as normal commands. In addition to referencing the formal parameters you can reference the ARGC vari