From the docs, it seems that arguments can’t have default values in Vim script. However, you can emulate this by defining a function with variable number of arguments, and using a:0
to determine the number of extra arguments and a:1
through a:n
to access them:
function Foo(bar, ...)
if a:0 > 0
let xyzzy = a:1
else
let xyzzy = 0
end
endfunction