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()

Comments (1)


Pepsh Pepshinsky

Let’s see you to :help viminfo-file-name (option -i) :set viminfofile=NONE


Speak Your Mind