On Mon, 31 Jul 2006 16:19:28 -0300, "Rodolfo Borges" <[EMAIL PROTECTED]> wrote:
> I made a file with vim commands, starting with > #!/usr/bin/vim -S > so I can execute the file directly, instead of using "vim -S file". > The problem is that vim tries to execute this first line too. > > Can we have a workaround on this? > Like, ignoring "#!" at the start of a command, instead of giving the > "no ! allowed" error? > Or am I having it all wrong? One way is to create a file that is both a valid shell script and a valid Vim script by starting the file with the following line: "exec" vim -S $0 "$@" [vim commands go here] (That's a dollar-zero after the -S, not dollar-capital-O.) When the shell runs this file it sees the exec command and runs Vim. Because $0 is the name of the script Vim opens the script and executes it, but it ignores the first line because it sees it as a comment. -- Matthew Winn