vimconfig/install

42 lines
811 B
Bash
Executable File

#! /bin/bash
repo_dir=$(pwd)
function backup() {
backup_dir="$repo_dir/.backup"
backup="$backup_dir/backup-$(date +%Y-%m-%d-%H-%M-%S)"
mkdir -p $backup_dir
mkdir -p $backup
existing_vim_config=$(find ~ -maxdepth 1 -name ".vim*")
rsync -rvvhu $existing_vim_config $backup
rm -rf $existing_vim_config
}
function symlink() {
vim_config=$(find $(pwd) -maxdepth 1 -name ".vim*")
for filepath in $vim_config; do
basename=$(basename $filepath)
ln -s $filepath ~/$basename
done
}
# Remove any installed plugins in this dir. Yuck.
rm -rf ./.vim/plugged
backup
symlink
# Append some lines to ~/.bashrc to stop the terminal
# from being frozen on Ctrl+S
cat <<EOT >> ~/.bashrc
bind -r '\C-s'
stty -ixon
EOT
# Make vim update the plugins before we ever start it
vim -nN -c "PlugUpdate" -c q