-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall
More file actions
executable file
·52 lines (45 loc) · 1.39 KB
/
Copy pathinstall
File metadata and controls
executable file
·52 lines (45 loc) · 1.39 KB
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
#!/usr/bin/env bash
create-symlink() {
local source=$1
local target=$2
if [[ -L "$target" ]]; then
unlink "$target"
fi
if [[ -f "$target" ]]; then
echo "File exists: $target" >&2
return 1
fi
if [[ ! -d $(dirname -- "$target") ]]; then
mkdir -p -- "$(dirname -- "$target")"
fi
ln -s -- "$(cd "$(dirname -- "$source")" && pwd)/$(basename -- "$source")" "$target"
}
install() {
local home=$HOME
local xdgconfig=${XDG_CONFIG_HOME:-$HOME/.config}
local xdgdata=${XDG_DATA_HOME:-$HOME/.local/share}
# git
create-symlink ./config/git "$xdgconfig/git"
# zsh
create-symlink ./config/zsh/.zshenv "$home/.zshenv"
create-symlink ./config/zsh "$xdgconfig/zsh"
# antigen
rm -rf -- "$xdgdata/antigen"
git clone --depth 1 https://github.com/zsh-users/antigen "$xdgdata/antigen"
# vim
create-symlink ./config/vim "$home/.vim"
# nvim
create-symlink ./config/nvim "$xdgconfig/nvim"
# tmux
create-symlink ./config/tmux "$xdgconfig/tmux"
# tpm
rm -rf -- "$xdgdata/tpm/plugins"
git clone --depth 1 https://github.com/tmux-plugins/tpm "$xdgdata/tpm/plugins"
# fzf
rm -rf -- "$xdgdata/antigen/bundles/junegunn/fzf"
git clone --depth 1 https://github.com/junegunn/fzf "$xdgdata/antigen/bundles/junegunn/fzf"
"$xdgdata"/antigen/bundles/junegunn/fzf/install --all --xdg --no-update-rc >/dev/null
# mise
create-symlink ./config/mise "$xdgconfig/mise"
}
install