Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

When I try to “execute” my function using the “execute echo Myfunc()\” command, the cursor is moved to the top of the current buffer. Why?

0
Posted

When I try to “execute” my function using the “execute echo Myfunc()\” command, the cursor is moved to the top of the current buffer. Why?

0

:execute” command runs the normal mode command specified by the argument. In the case of the following command: :execute “echo Myfunc()” The call to “echo Myfunc()” will return 0. The “:execute” command will run the normal mode 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() For more information, read :help :call :help :execute :help :echo :help user-functions :help 41.5 :help 41.

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.