-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsetup_dotfiles
More file actions
executable file
·101 lines (85 loc) · 3.41 KB
/
setup_dotfiles
File metadata and controls
executable file
·101 lines (85 loc) · 3.41 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
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
#! /bin/bash
mkdir -p ~/.config
for value in nvim
do
echo "Linked ${value} config"
cp -al dotfiles/.config/$value ~/.config > /dev/null 2>&1
done
ln -f dotfiles/tmux.conf ~/.tmux.conf
echo "Linked tmux.conf"
ln -f dotfiles/vimrc ~/.vimrc_haran
echo "Linked vimrc"
ln -f dotfiles/gitconfig ~/.gitconfig
echo "Linked gitconfig"
if [[ -e ~/.zshrc ]]; then
ln -f dotfiles/zsh_profile ~/.zsh_profile
if [[ -z $(cat ~/.zshrc | grep "source ~/.zsh_profile") ]]; then
echo "source ~/.zsh_profile" >> ~/.zshrc
fi
echo "Linked zsh_profile and configured zshrc to source it"
echo "Restart the terminal for changes to take effect"
else
ln -f dotfiles/bash_profile ~/.bsh_prof
if [[ -z $(cat ~/.bashrc | grep "source ~/.bsh_prof") ]]; then
echo "source ~/.bsh_prof" >> ~/.bashrc
fi
echo "Linked bash_profile and configured bashrc to source it"
echo "Restart the terminal for changes to take effect"
fi
repo_root="$(cd "$(dirname "$0")" && pwd)"
commands_dir="$repo_root/dotfiles/commands"
if [[ ! -d "$commands_dir" ]]; then
echo "Commands directory not found at $commands_dir" >&2
else
command_snippet=$'# install-scripts commands\npath_add="'"$commands_dir"$'"\nif [[ -d "$path_add" && ":$PATH:" != *":$path_add:"* ]]; then\n export PATH="$path_add:$PATH"\nfi\nunset path_add\n'
if [[ -e ~/.zshrc ]]; then
if ! grep -Fq "$commands_dir" ~/.zshrc; then
printf '%s\n' "$command_snippet" >> ~/.zshrc
fi
fi
if [[ -e ~/.bashrc ]]; then
if ! grep -Fq "$commands_dir" ~/.bashrc; then
printf '%s\n' "$command_snippet" >> ~/.bashrc
fi
fi
if [[ -n ${ZDOTDIR:-} && -e "${ZDOTDIR}/.zshrc" ]]; then
if ! grep -Fq "$commands_dir" "${ZDOTDIR}/.zshrc"; then
printf '%s\n' "$command_snippet" >> "${ZDOTDIR}/.zshrc"
fi
fi
echo "Ensured dotfiles command scripts at $commands_dir are on PATH"
fi
if [ $(uname -s) = "Linux" ]; then
echo "Detected linux"
#mkdir -p ~/.dir_colors/dircolors
#ln -f dotfiles/dircolors ~/.dir_colors/dircolors
#echo "Hard-linked dircolors"
#mkdir -p ~/.config/terminator
#ln -f dotfiles/terminator_config ~/.config/terminator/config
#echo "Hard-linked terminator config"
elif [ $(uname -s) = "Darwin" ]; then
# for value in karabiner ranger sketchybar skhd yabai
# do
# echo "Linked ${value} config"
# cp -al dotfiles/.config/$value ~/.config > /dev/null 2>&1
# done
echo "Detected macOS"
cp dotfiles/com.googlecode.iterm2.plist ~/Library/Preferences
mkdir -p ~/Library/Application\ Support/MailMate/Resources/KeyBindings/
ln -f dotfiles/mailmate_keybindings.plist ~/Library/Application\ Support/MailMate/Resources/KeyBindings/MyKBDs.plist
echo "Linked MailMate config"
cp -r dotfiles/mailmate_bundles/* ~/Library/Application\ Support/MailMate/Bundles/
echo "Linked MailMate bundles"
# Cursor settings
mkdir -p ~/Library/Application\ Support/Cursor/User
ln -sf "$repo_root/dotfiles/cursor/settings.json" ~/Library/Application\ Support/Cursor/User/settings.json
echo "Linked Cursor settings.json"
# Cursor agents & skills (symlink directories)
mkdir -p ~/.cursor
ln -sfn "$repo_root/dotfiles/cursor/agents" ~/.cursor/agents
ln -sfn "$repo_root/dotfiles/cursor/skills" ~/.cursor/skills
echo "Linked Cursor agents and skills"
else
echo $OSTYPE
echo "OS not recognized"
fi