# arg 1: the new package version
post_install() {
    echo '%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%'
    echo '% Set the following lines in your ~/.vimrc or the systemwide /etc/vimrc:'
    echo '% filetype plugin indent on'
    echo '% set grepprg=grep\ -nH\ $*'
    echo '% let g:tex_flavor = "latex"'
    echo '% '
    echo '% Also, this installs to /usr/share/vim/vimfiles, which may not be in'
    echo '% your runtime path (RTP). Be sure to add it too, e.g:'
    echo '% set runtimepath=~/.vim,$VIM/vimfiles,$VIMRUNTIME,$VIM/vimfiles/after,~/.vim/after'
    echo '%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%'

    # rebuild the vim documentation tags
    echo -n "Updating vim help tags..."
    /usr/bin/vim --noplugins -u NONE -U NONE \
        --cmd ":helptags /usr/share/vim/vimfiles/doc" --cmd ":q" > /dev/null 2>&1
    echo "done."

}

# arg 1: the new package version
# arg 2: the old package version
post_upgrade() {
    echo -n "Updating vim help tags..."
    /usr/bin/vim --noplugins -u NONE -U NONE \
        --cmd ":helptags /usr/share/vim/vimfiles/doc" --cmd ":q" > /dev/null 2>&1
    echo "done."
}

# arg 1: the old package version
post_remove() {
    echo -n "Updating vim help tags..."
    /usr/bin/vim --noplugins -u NONE -U NONE \
        --cmd ":helptags /usr/share/vim/vimfiles/doc" --cmd ":q" > /dev/null 2>&1
    echo "done."
}

op=$1
shift
$op $* 
