On 8/1/06, A.J.Mechelynck <[EMAIL PROTECTED]> wrote:
Rodolfo Borges 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.

Method I:
-----8<----- foo (or whatever)
#!/bin/bash
vim -S foo.vim
----->8-----

And you can of course make it more general by parameterizing the
script name and create additional scripts that delegate to this one.

Another solution is to use Zsh:

#! /bin/zsh
exec vim -S =(<<'EOS'
echoerr 'hello'
EOS
)

Method II: add to one of your shell startup scripts (~/.bashrc or whatever):

       alias foo='vim -S ~/foo.vim'

And again, another one for Zsh:

 alias -s vim='vim -S'

Finally, it wouldn't be impossible to make the source command be a bit
more flexible in this regard, disregarding a she-bang line if one is
found.

 nikolai

Reply via email to