[ILUG] attention vim gods!

Kenn Humborg kenn at linux.ie
Tue Jan 25 23:29:41 GMT 2000


On Tue, Jan 25, 2000 at 12:10:30PM +0000, kevin lyda wrote:
> any idea if it's possible to script vim to automagically add the line
> 
> #!/usr/bin/perl
> 
> any time you type vi foo.pl iff foo.pl doesn't exist?  same q for
> #!/bin/sh and foo.sh.

Perhaps easiest to do something like in your .bashrc:

function vi ()
{
   if [ ! -f $1 ] ; then
      case $1 in
         *.pl 
            echo '#!'`which perl` >> $1 ;;
         *.sh
            echo '#!'`which sh` >> $1 ;;
      esac
   fi

   `which vi` $*
}






More information about the ILUG mailing list