-
Notifications
You must be signed in to change notification settings - Fork 2
/
install.sh
executable file
·75 lines (59 loc) · 2.01 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#!/bin/bash
# Installs dotfiles and helpers
realpath() {
[[ $1 = /* ]] && echo "$1" || echo "$PWD/${1#./}"
}
safe_link(){
local src="$1"
local dest="$HOME/`basename $src`"
[ ! -e "$dest" ] && ln -sf "$src" "$dest"
}
# Get root
SCRIPT_PATH=`realpath $0`
DOTFILES=`dirname $SCRIPT_PATH`
# Install bin scripts
safe_link "$DOTFILES/bin"
# Install other dotfiles
for f in `ls -A $DOTFILES/dotfiles`; do
safe_link "$DOTFILES/dotfiles/$f"
done
# Create persistent undo dir for vim
mkdir -p ~/.vim/undo
# Initialize and update submodules (for vim plugins)
#git submodule init
#git submodule update
# Set git user
[ -z `git config --global user.name` ] && git config --global user.name "Enrico"
[ -z `git config --global user.email` ] && git config --global user.email "[email protected]"
# Configure diff / merge tool
if [ `uname` == "Darwin" ]; then
git config --global merge.tool opendiff
git config --global diff.tool opendiff
echo 'Install Menlo font from:'
echo 'https://gist.github.com/qrush/1595572#file-menlo-powerline-otf'
else
git config --global merge.tool meld
git config --global diff.tool meld
fi
# Global ignores
git config --global core.excludesfile '~/.gitignore_global'
# Disable ".orig" backups
git config --global mergetool.keepBackup false
# Automatically track new branches
git config --global push.default tracking
git config --global branch.autosetupmerge true
# Always rebase when pulling
git config --global branch.autosetuprebase always
# Colored output
git config --global color.ui auto
# Git aliases
_git_lg="log --format='%C(green)%h %C(red)%cd %C(reset)%s %C(blue)%an%C(yellow)%d' --date=relative"
git config --global alias.st status
git config --global alias.ci commit
git config --global alias.sw switch
git config --global alias.re restore
git config --global alias.br branch
git config --global alias.fpush "push --force-with-lease"
git config --global alias.lg "$_git_lg"
git config --global alias.l "$_git_lg -10"
git config --global alias.ln "$_git_lg -10 --name-only"