forked from nictuku/dot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.sh
47 lines (38 loc) · 1.05 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
47
#!/bin/bash
set -eu
cd ~
if [[ ! -d "dot" ]]; then
git clone https://github.com/nictuku/dot.git
fi
# for OSX
realpath() {
[[ $1 = /* ]] && echo "$1" || echo "$PWD/${1#./}"
}
for x in dot/home/*; do
t=$(date +%s)
x=$(realpath $x)
base=$(basename $x)
dir=$(dirname $x)
echo -n "Backing up: "
mv -v ~/.$base{,.$t} || true
echo -n "Linking: "
ln -v -s $dir/$base ~/.$base
done
# Pathogen vim plugin manager
mkdir -p ~/.vim/autoload ~/.vim/bundle && \
curl -LSso ~/.vim/autoload/pathogen.vim https://tpo.pe/pathogen.vim
function clone() {
repo=$1 # https://github.com/fatih/vim-go.git
dest=$2 # ~/.vim/pack/plugins/start/vim-go
mkdir -p $dest
cd $dest
git init
if ! git config remote.origin.url &> /dev/null;then
git remote add origin $repo
fi
git fetch origin master
git reset origin/master # --hard to wipe everything but is dangerous
}
# vim-go
clone https://github.com/fatih/vim-go.git ~/.vim/pack/plugins/start/vim-go
clone git://github.com/ntpeters/vim-better-whitespace.git ~/.vim/bundle/vim-better-whitespace