forked from skyfireitdiy/dotfile
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
executable file
·152 lines (118 loc) · 3.37 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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
#!/bin/bash
bak_config() {
old_config=$1
bak_config=${1}_bak
if [ -f $bak_config ] || [ -d $bak_config ]; then
echo "删除旧的备份文件" $bak_config
rm -rf $bak_config
fi
if [ -f $old_config ] || [ -d $old_config ] ; then
mv $old_config ${old_config}_bak
echo "备份$old_config 到 ${old_config}_bak"
fi
}
replace_config() {
old_config=$1
new_config=$2
bak_config $old_config
ln -sf $new_config $old_config
echo "软链接 $old_config 到 $new_config"
}
config_alacritty() {
replace_config ~/.config/alacritty $(pwd)/alacritty
echo "alacritty 安装完成!"
}
config_polybar() {
replace_config ~/.config/polybar $(pwd)/polybar
echo "polybar 安装完成!"
}
config_vim(){
bak_config ~/.config/nvim
bak_config ~/.local/share/nvim/site
rm -rf ~/.config/nvim ~/.local/share/nvim/site
mkdir -p ~/.config
mkdir -p ~/.local/share
replace_config ~/.config/nvim $(pwd)/vim/nvim
sudo cp $(pwd)/clipboard-provider /usr/local/bin
nvim --version 2>/dev/null
if [ $? -eq 0 ]; then
nvim
fi
echo "nvim配置成功!"
}
config_fish(){
mkdir -p ~/.config
replace_config ~/.config/fish $(pwd)/fish
echo fish 配置成功
}
config_tmux(){
bak_config ~/.tmux
git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm
replace_config ~/.tmux.conf $(pwd)/_tmux.conf
echo tmux配置成功!
}
config_i3() {
replace_config ~/.config/i3 $(pwd)/i3
replace_config ~/.config/polybar $(pwd)/polybar
echo i3 配置成功!
}
config_kitty() {
replace_config ~/.config/kitty $(pwd)/kitty
echo kitty 配置成功!
}
config_konsole() {
replace_config ~/.local/share/konsole $(pwd)/konsole
# mkdir -p /tmp/konsole_backgrounds
# cp ~/.local/share/konsole/background/* /tmp/konsole_backgrounds/
echo konsole 配置成功!
}
config_x() {
replace_config ~/.xprofile $(pwd)/_xprofile
echo x 配置成功!
}
config_hx() {
replace_config ~/.config/helix/config.toml $(pwd)/helix/config.toml
echo hx 配置成功!
}
config_rime() {
replace_config ~/.config/fcitx5/rime/default.custom.yaml $(pwd)/rime/default.custom.yaml
replace_config ~/.config/fcitx5/rime/luna_pinyin_simp.custom.yaml $(pwd)/rime/luna_pinyin_simp.custom.yaml
replace_config ~/.config/fcitx5/rime/weasel.custom.yaml $(pwd)/rime/weasel.custom.yaml
replace_config ~/.config/fcitx5/rime/sogoupinyin.dict.yaml $(pwd)/rime/sogoupinyin.dict.yaml
echo "rime 配置完成"
}
config_ranger() {
replace_config ~/.config/ranger $(pwd)/ranger
echo "ranger 配置完成"
}
config_pacman() {
replace_config /etc/pacman.d $(pwd)/pacman/pacman.d
replace_config /etc/pacman.conf $(pwd)/pacman/pacman.conf
echo "pacman 配置完成"
}
config_conda() {
replace_config ~/.condarc $(pwd)/_condarc
echo "conda 配置完成"
}
config_pip() {
replace_config ~/.config/pip $(pwd)/pip
echo "pip 配置完成"
}
config_zellij () {
replace_config ~/.config/zellij $(pwd)/zellij
echo "zellij 配置完成"
}
config_ssh () {
mkdir -p ~/.ssh
replace_config ~/.ssh/config $(pwd)/ssh/config
echo "ssh 配置完成"
}
config_pypi() {
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
echo "pypi 配置完成"
}
while test $# -gt 0
do
config_$1
shift
done