Question reposted on StackOverflow, where it's receiving more attention.
Given the following function in the
fu! MyFun(count) echo a:count echo a:count if a:count > 0 normal , call MyFun(a:count - 1) endif endf
:call MyFun(3) generates the following output.
3 3 2 2 1 1 0 0
However, if I define the mapping
nn , :<C-U>execute "call MyFun(" . v:count . ")"<CR>, then the call to
:call MyFun(3) generates
3 0 2 0 1 0 0 0
I do understand that the mapping of
, makes the
MyFun function call itself twice (
if a:count > 0), however I cannot understand how this can cause a different result of the two successive calls to