-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.zsh
executable file
·43 lines (34 loc) · 1.01 KB
/
setup.zsh
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
#!/usr/bin/env zsh
# Function to create symbolic links
create_symlink() {
src="$1"
dest="$2"
# Create parent directory if it doesn't exist
parent_dir=$(dirname "$dest")
mkdir -p "$parent_dir"
# Confirm if the file already exists
if [[ -e "$dest" ]]; then
read "yn?$dest already exists. Overwrite? [y/N] "
case $yn in
[Yy]* ) ;;
* ) return;;
esac
fi
# Create the symbolic link
ln -sf "$src" "$dest"
}
# List of files and directories to include
include=(".zshrc" ".vimrc" ".nanorc" ".config/nvim/init.lua" ".config/wezterm/wezterm.lua" ".config/doom/config.el" ".config/doom/init.el" ".config/doom/packages.el")
# Path to the dotfiles directory
dotfiles_dir="$PWD"
# Create symbolic links for specified files and directories in the dotfiles directory
for file in $include; do
src="$dotfiles_dir/$file"
dest="$HOME/$file"
# Check if the source file exists
if [[ ! -e "$src" ]]; then
echo "$src does not exist. Skipping."
continue
fi
create_symlink "$src" "$dest"
done