-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup
executable file
·93 lines (77 loc) · 3.22 KB
/
setup
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#!/bin/zsh
# Functions for Linux specific tasks
setup_linux() {
# Link to the zsh config
ln -s -f $(readlink -en $(dirname $0)/zshrc) ~/.zshrc
# Link to the vim config
ln -s -f $(readlink -en $(dirname $0)/vimrc) ~/.vimrc
# Install Vundle and all plugins
[ -d ~/.vim/bundle/Vundle.vim ] && rm -rf ~/.vim/bundle/Vundle.vim
git clone https://github.com/gmarik/Vundle.vim.git ~/.vim/bundle/Vundle.vim
vim +PluginInstall +qall
# Download a font needed for airline
mkdir -p ~/.fonts
wget 'https://github.com/Lokaltog/powerline-fonts/raw/master/DejaVuSansMono/DejaVu Sans Mono for Powerline.ttf' \
-O ~/.fonts/DejaVu\ Sans\ Mono\ for\ Powerline.ttf
fc-cache -f ~/.fonts
# Configure terminator with the font and set it as default
mkdir -p ~/.config/terminator
ln -s -f $(readlink -en $(dirname $0)/terminator_config) ~/.config/terminator/config
gsettings set org.gnome.desktop.default-applications.terminal exec 'terminator'
ß
# Install fuzzy finder
git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf
~/.fzf/install
}
# Functions for Mac specific tasks
setup_mac() {
# Link to the zsh config
ln -s -f $(readlink -f $(dirname $0)/zshrc) ~/.zshrc
# Link to the vim config
ln -s -f $(readlink -f $(dirname $0)/vimrc) ~/.vimrc
# Install Vundle and all plugins
[ -d ~/.vim/bundle/Vundle.vim ] && rm -rf ~/.vim/bundle/Vundle.vim
git clone https://github.com/gmarik/Vundle.vim.git ~/.vim/bundle/Vundle.vim
vim +PluginInstall +qall
# Download a font needed for airline
mkdir -p ~/Library/Fonts
curl -L 'https://github.com/supermarin/powerline-fonts/raw/master/Monaco/Monaco%20for%20Powerline.otf' \
-o ~/Library/Fonts/Monaco\ for\ Powerline.otf
fc-cache -f ~/Library/Fonts
# Install Homebrew if not already installed
if ! command -v brew &>/dev/null; then
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
fi
# Configure iTerm2 with the font and set it as default (if using iTerm2)
if ! brew list | (grep -q iterm2; ret=$?; cat >/dev/null; exit $ret); then
brew install --cask iterm2
fi
defaults write com.googlecode.iterm2.plist PrefsCustomFolder -string "~/.iterm2"
defaults write com.googlecode.iterm2.plist LoadPrefsFromCustomFolder -bool true
mkdir -p ~/.iterm2
ln -s -f $(readlink -f $(dirname $0)/com.googlecode.iterm2.plist) ~/.iterm2/com.googlecode.iterm2.plist
# Install fuzzy finder
if ! brew list | (grep -q fzf; ret=$?; cat >/dev/null; exit $ret); then
brew install fzf
$(brew --prefix)/opt/fzf/install
fi
}
# Common setup for both Linux and macOS
common_setup() {
# Setup some git defaults
ln -s -f $(readlink -f $(dirname $0)/gitignore_global) ~/.gitignore_global
git config --global core.excludesfile ~/.gitignore_global
git config --global user.name "Alexander Hermans"
git config --global user.email "[email protected]"
git config --global push.default "matching"
}
# Detect OS
OS=$(uname)
# Run OS-specific setup
if [ "$OS" = "Linux" ]; then
setup_linux
elif [ "$OS" = "Darwin" ]; then
setup_mac
fi
# Finish by running the common setup
common_setup