forked from werebus/vimfiles
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.sh
More file actions
executable file
·30 lines (26 loc) · 1.04 KB
/
Copy pathsetup.sh
File metadata and controls
executable file
·30 lines (26 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/bin/sh
die() {
echo "${@}"
exit 1
}
# Add .local to existing Vim and Bash config files in the home directory
# or add .old if .local files already exist
for i in $HOME/.vimrc $HOME/.gvimrc $HOME/.bashrc $HOME/.bash_aliases; do
if [ -e "$i" ]; then
if [ -e "${i}.local" ]; then
echo "${i}.local already exists"
echo "Renaming ${i} to ${i}.old"
mv "${i}" "${i}.old" || die "Could not move ${i} to ${i}.old"
else
echo "Renaming ${i} to ${i}.local"
mv "${i}" "${i}.local" || die "Could not move ${i} to ${i}.local"
fi
fi
done
# Symlink .vim config files to $HOME dir
ln -s "$HOME/.vim/vimrc" "$HOME/.vimrc" || die "Could not symlink .vimrc file"
ln -s "$HOME/.vim/gvimrc" "$HOME/.gvimrc" || die "Could not symlink .gvimrc file"
ln -s "$HOME/.vim/bashrc" "$HOME/.bashrc" || die "Could not symlink .bashrc file"
ln -s "$HOME/.vim/bash_aliases" "$HOME/.bash_aliases" || die "Could not symlink .bash_aliases file"
# Call reset_modules.sh
[ -f "$HOME/.vim/reset_submodules.sh" ] && "$HOME/.vim/reset_submodules.sh"