The following commands work fine when I issue them from the command mode in Vim:
But when I run the above commands as a script as below:
vim -c "commands.vim" myfile.c
I get errors:
Note: I am aware of this question: How to use "-c" command line option? but it has not helped with the error.
-cexpects a Vim command. Merely mentioning a vimscript is not a command.