When I try to “execute” my function using the “execute Myfunc()”
command, the cursor is moved to the top of the current buffer. Why? The “:execute” command runs the ex command specified by the argument. In the case of the following command:
:execute Myfunc()
The call to Myfunc() will return 0. The “:execute” command will run the ex command “:0”, which moves the cursor to the top of the file. To call a Vim function, you should use the “:call” command instead of the “:execute” command:
:call Myfunc()
Read free Software Algorithms and Computer Science Books by CodeAhoy Learn.
Introduction to Recursion and Backtracking