Indeed, THIS is! nice...
The tutorial is a little out of date, though -- at least if you want the latest version. You don't need to change your .vimrc [well, you do have to include 'filetype plugin on'], everything works through templates now...
So I wrote a script that installs it and configures some basic stuff.
Code:
#!/bin/bash
#written by iesaya
#requires wget, unzip
#create ~/.vim dir if doesn't exist
if [ ! -d $HOME/.vim ]; then
mkdir $HOME/.vim
fi
#download bash-support v.3.0.1
wget -O $HOME/.vim/bash-support.zip http://www.vim.org/scripts/download_script.php?src_id=11913
#extract bash-support
unzip $HOME/.vim/bash-support.zip -d $HOME/.vim/
#sets AUTHOR,EMAIL,COMPANY
echo ""
echo "**********************************************"
echo "if you leave empty, default '---' will be used"
echo "**********************************************"
echo ""
echo -n "type in your name: "
read name
echo -n "type in your email: "
read email
echo -n "type in your company: "
read comp
if [ "$name" = "" ]; then
echo "|AUTHOR| = ---" >> $HOME/.vim/bash-support/templates/Templates
else
echo "|AUTHOR| = $name" >> $HOME/.vim/bash-support/templates/Templates
fi
echo "|AUTHORREF| = ---" >> $HOME/.vim/bash-support/templates/Templates
if [ "$email" = "" ]; then
echo "|EMAIL| = ---" >> $HOME/.vim/bash-support/templates/Templates
else
echo "|EMAIL| = $email" >> $HOME/.vim/bash-support/templates/Templates
fi
if [ "$comp" = "" ]; then
echo "|COMPANY| = --- " >> $HOME/.vim/bash-support/templates/Templates
else
echo "|COMPANY| = $comp" >> $HOME/.vim/bash-support/templates/Templates
fi
echo ""
echo "******************************************************************************"
echo "you can change those values by editing ~/.vim/bash-support/templates/Templates"
echo "******************************************************************************"
and I changed my first script. As bash-support needs an *.sh ending, the script will check for it and if it is missing, will insert it.
I couldn't get pass the fact, that vim needs to terminate in order for the script to execute chmod though... :-(
Code:
#!/bin/bash
#written by iesaya
if [ -n "$1" ]; then
arg=$1
var=${arg##*.} #checks the ending of the file
if [ $var = "sh" ]; then
vim $arg
chmod +x $arg*
else
vim $arg.sh
chmod +x $arg*
fi
else
echo "This command needs an argument"
fi