-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinstall.sh
executable file
·60 lines (49 loc) · 1.44 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
#!/bin/bash
set -e
set -u
: docker container run --rm -it -v "$PWD:$PWD":ro -w "$PWD" alpine:3 sh -c '
apk --no-cache add bash curl git vim
./install.sh
ls -Al ~
'
ROOT=${ROOT:-~/src/github.com/m5d215/dotfiles}
if [ ! -d "$ROOT" ]; then
git clone https://github.com/m5d215/dotfiles.git "$ROOT"
fi
mkdir -p ~/.config
mkdir -p ~/.zsh
function create_link {
local _src
local _dest
_src=$1
_dest=${2:-$1}
if [ -e "$HOME/$_dest" ] && [ ! -s "$HOME/$_dest" ]; then
mkdir -p "$HOME/.dotfiles-backup"
mv "$HOME/$_dest" "$HOME/.dotfiles-backup/$_dest"
fi
rm -f "$HOME/$_dest"
ln -fsv "$ROOT/src/$_src" "$HOME/$_dest"
}
create_link .config/git
create_link .config/zabrze
create_link .zsh/functions
create_link .zsh/.zshenv
create_link .zsh/.zshrc
create_link bin
create_link .bash_profile
create_link .bashrc
create_link .editorconfig4 .editorconfig
create_link .tmux.conf
create_link .vimrc
create_link .zshenv
# Install Tmux Plugin Manager
if [ ! -d ~/.tmux/plugins/tpm ]; then
git clone https://github.com/tmux-plugins/tpm.git ~/.tmux/plugins/tpm
fi
# Install vim-plug
if [ ! -f ~/.vim/autoload/plug.vim ]; then
curl -fsSL https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim -o ~/.vim/autoload/plug.vim --create-dirs
sed -e '/colorscheme/d' ~/.vimrc >/tmp/.vimrc_deleteme
vim -u /tmp/.vimrc_deleteme +PlugInstall +qall </dev/null >/dev/null 2>&1
rm /tmp/.vimrc_deleteme
fi