-
Notifications
You must be signed in to change notification settings - Fork 5
/
link.sh
executable file
·48 lines (41 loc) · 1.41 KB
/
link.sh
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#
# USAGE: ./link.sh
#
# DESCRIPTION: Link all profile files
#
# AUTHOR: Ming Chen, v.mingchen@gmail.com
# CREATED: 07/20/2010 10:30:23 AM CST
#===============================================================================
set -o nounset # Treat unset variables as an error
set -o errexit # Stop script if command fail
IFS=$' \t\n' # Reset IFS
unset -f unalias # Make sure unalias is not a function
\unalias -a # Unset all aliases
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
prof="$HOME/profile"
function link_files()
{
for i in "$@"; do
if [ "$i" = "link.sh" ]; then
continue
fi
if [ -f "$HOME/$i" ]; then
mv "$HOME/$i" "$HOME/$i.bak"
fi
if [ -L "$HOME/$i" ]; then
rm "$HOME/$i"
fi
ln -s "$prof/$i" "$HOME/$i"
done
}
link_files .vimrc .vim .bash_profile .bashrc .spacemacs .gdb .gdbinit \
.gitconfig .git-completion.bash .gitignore .gitaliases \
.screenrc .tmux.conf .zshrc .zshenv .ackrc .pylintrc .style.yapf \
.tmux
ln -s "$prof/.vimrc" ~/.nvimrc
ln -s "$prof/.vim" ~/.nvim
ln -s "$prof/.vim" ~/.vim
ln -s "$prof/i3" ~/.i3
# use google style for the default code style
# [ -f .clang-format ] || ln -s "$prof/google.clang-format" ~/.clang-format
# echo "run ':PluginInstall' in vim to install vim plugins"