The following commands work fine when I issue them from the command mode in Vim:
:%s/\(^\s\+\)\(\S\+.*)\s*\){$/\1\2\r\1{/g
:g/^\s*\/\/$/d
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.
-c
expects a Vim command. Merely mentioning a vimscript is not a command.