-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup_configs.sh
executable file
·64 lines (53 loc) · 1.72 KB
/
setup_configs.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
#!/bin/bash
# 设置颜色输出
GREEN='\033[0;32m'
NC='\033[0m' # No Color
# 获取当前目录的绝对路径
DOTFILES=$(pwd)
# 打印信息函数
print_message() {
echo -e "${GREEN}==>${NC} $1"
}
# 创建符号链接函数
create_link() {
local src=$1
local dst=$2
if [ -e "$dst" ]; then
print_message "备份已存在的 $dst 到 ${dst}.backup"
mv "$dst" "${dst}.backup"
fi
ln -sf "$src" "$dst"
print_message "创建链接: $src -> $dst"
}
# 设置 Yazi 配置
setup_yazi() {
print_message "设置 Yazi 配置..."
mkdir -p ~/.config/yazi
create_link "$DOTFILES/yazi/yazi.toml" ~/.config/yazi/yazi.toml
create_link "$DOTFILES/yazi/keymap.toml" ~/.config/yazi/keymap.toml
create_link "$DOTFILES/yazi/theme.toml" ~/.config/yazi/theme.toml
print_message "Yazi 配置完成!"
}
# 主设置函数
main() {
print_message "开始创建配置文件链接..."
# 创建必要的配置目录
mkdir -p ~/.config/nvim
mkdir -p ~/.config/wezterm
mkdir -p ~/.config/karabiner
mkdir -p ~/.tmux
mkdir -p ~/.config/aerospace
# 创建配置文件链接
create_link "$DOTFILES/nvim" ~/.config/nvim
create_link "$DOTFILES/wezterm/.wezterm.lua" ~/.wezterm.lua
create_link "$DOTFILES/karabiner/karabiner.json" ~/.config/karabiner/karabiner.json
create_link "$DOTFILES/tmux/.tmux.conf" ~/.tmux.conf
create_link "$DOTFILES/zsh/.zshrc" ~/.zshrc
create_link "$DOTFILES/ideavim/.ideavimrc" ~/.ideavimrc
create_link "$DOTFILES/aerospace/.aerospace.toml" ~/.config/aerospace/aerospace.toml
# 设置 Yazi 配置
setup_yazi
print_message "配置文件链接创建完成!"
print_message "请重启终端以使更改生效。"
}
main