-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.sh
46 lines (38 loc) · 1.09 KB
/
install.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
#!/usr/bin/bash
#
# Install dotfiles to $HOME.
dot_home="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
date=`date +%Y-%m-%d`
# Create a hidden symlink for the input config file.
# Arg $1: config type (e.g. "vimrc")
symlink_hidden() {
config_file=$HOME/.$1
if [[ -h $config_file ]]; then
# Remove any existing links.
echo "Clearing existing link $config_file";
rm $config_file;
elif [[ -e $config_file ]]; then
# Back up any existing files.
config_backup=$config_file.bak.$date;
echo "Moving existing $1 to $config_backup";
mv $config_file $config_backup;
fi
ln -s $dot_home/$1 $config_file
}
for config in vimrc tmux.conf inputrc
do
symlink_hidden "$config"
done
# Use the new .inputrc.
# bind -f $HOME/.inputrc
# Install Vim-Plug.
if [[ ! -e "$HOME/.vim/autoload/plug.vim" ]]; then
curl -fLo $HOME/.vim/autoload/plug.vim --create-dirs \
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
fi
# Create the plugin directory.
if [[ ! -e "$HOME/.vim/plugged" ]]; then
mkdir $HOME/.vim/plugged
fi
# Install the vim plugins.
vi +PlugUpdate +qall