# Make a backup before changing the configuration file
pre_install() {
    if [ -f /etc/vimrc ]; then
        mv -f /etc/vimrc /etc/vimrc.bkp
    fi
}

# Replace the original file with the new configuration file
post_install() {
    if [ -f /etc/vimrc.new ]; then
        mv -f /etc/vimrc.new /etc/vimrc
    fi  
}

# Restore the original file
post_remove() {
    if [ -f /etc/vimrc.bkp ]; then
        mv -f /etc/vimrc.bkp /etc/vimrc
    fi
    # Remove the plugin directory if it is empty
    if [ -d /usr/share/vim/vimfiles/pack/git-plugins ]; then
        rm -rf /usr/share/vim/vimfiles/pack/git-plugins
    fi    
}
