update dotfiles
This commit is contained in:
1
.zshrc
1
.zshrc
@@ -158,3 +158,4 @@ eval "$(atuin init zsh)"
|
||||
eval "$(atuin init zsh)"
|
||||
eval "$(atuin init zsh)"
|
||||
eval "$(atuin init zsh)"
|
||||
eval "$(atuin init zsh)"
|
||||
|
||||
107
update.sh
107
update.sh
@@ -1,20 +1,101 @@
|
||||
#!/bin/bash
|
||||
|
||||
# This script syncs dotfiles from ~/.config to this git repository.
|
||||
# It uses rsync to efficiently copy only changed files.
|
||||
|
||||
REPO_PATH="$HOME/repos/dotfiles-new"
|
||||
CONFIG_PATH="$HOME/.config"
|
||||
|
||||
cp -r ~/.config/alacritty "$REPO_PATH"
|
||||
cp -r ~/.config/hypr "$REPO_PATH"
|
||||
cp -r ~/.config/i3 "$REPO_PATH"
|
||||
cp -r ~/.config/nvim "$REPO_PATH"
|
||||
cp -r ~/.config/polybar "$REPO_PATH"
|
||||
cp -r ~/.config/tofi "$REPO_PATH"
|
||||
cp -r ~/.config/waybar "$REPO_PATH"
|
||||
cp -r ~/.config/dunst "$REPO_PATH"
|
||||
cp -r ~/.zshrc "$REPO_PATH"
|
||||
cp -r ~/.config/compfy "$REPO_PATH"
|
||||
cp -r ~/.config/rofi "$REPO_PATH"
|
||||
# Common exclude patterns for applications like VSCode, Obsidian, etc.
|
||||
# This helps to avoid syncing cache, logs, and other transient files.
|
||||
declare -a excludes=(
|
||||
--exclude='*Cache*'
|
||||
--exclude='*cache*'
|
||||
--exclude='Cache'
|
||||
--exclude='logs'
|
||||
--exclude='Crashpad'
|
||||
--exclude='blob_storage'
|
||||
--exclude='workspaceStorage'
|
||||
--exclude='History'
|
||||
--exclude='Service Worker'
|
||||
--exclude='GPUCache'
|
||||
--exclude='Dawn*'
|
||||
--exclude='*journal*'
|
||||
--exclude='LOCK'
|
||||
--exclude='*.log'
|
||||
--exclude='CachedData'
|
||||
--exclude='CachedExtensionVSIXs'
|
||||
--exclude='Code Cache'
|
||||
--exclude='Session Storage'
|
||||
--exclude='Shared Dictionary'
|
||||
--exclude='WebStorage'
|
||||
--exclude='Backups'
|
||||
--exclude='sentry'
|
||||
--exclude='databases'
|
||||
--exclude='IndexedDB'
|
||||
--exclude='User/History'
|
||||
--exclude='User/workspaceStorage'
|
||||
|
||||
# More specific exclusions for VSCode/VSCodium/Cursor
|
||||
--exclude='User/globalStorage'
|
||||
--exclude='Local Storage'
|
||||
--exclude='Dictionaries'
|
||||
--exclude='code.lock'
|
||||
--exclude='Cookies'
|
||||
--exclude='CachedProfilesData'
|
||||
--exclude='languagepacks.json'
|
||||
)
|
||||
|
||||
# List of configurations to sync from ~/.config
|
||||
# Add new config directory names to this list.
|
||||
declare -a configs_to_sync=(
|
||||
"atuin"
|
||||
"Cursor"
|
||||
"flameshot"
|
||||
"kitty"
|
||||
"MangoHud"
|
||||
"mpv"
|
||||
"neofetch"
|
||||
"obsidian"
|
||||
"regolith3"
|
||||
"VSCodium"
|
||||
)
|
||||
|
||||
echo "Starting dotfiles sync..."
|
||||
|
||||
# Sync configurations from ~/.config
|
||||
for config in "${configs_to_sync[@]}"; do
|
||||
source_path="$CONFIG_PATH/$config"
|
||||
if [ -d "$source_path" ]; then
|
||||
echo "Syncing $config..."
|
||||
# Use --delete to remove files in the repo that are no longer in the source config.
|
||||
# The exclude patterns are applied here.
|
||||
rsync -av --delete "${excludes[@]}" "$source_path" "$REPO_PATH/"
|
||||
else
|
||||
echo "Warning: Directory $source_path does not exist. Skipping."
|
||||
fi
|
||||
done
|
||||
|
||||
# Sync individual files like .zshrc
|
||||
zshrc_path="$HOME/.zshrc"
|
||||
if [ -f "$zshrc_path" ]; then
|
||||
echo "Syncing .zshrc..."
|
||||
rsync -av "$zshrc_path" "$REPO_PATH/"
|
||||
else
|
||||
echo "Warning: File $zshrc_path does not exist. Skipping."
|
||||
fi
|
||||
|
||||
|
||||
echo "Sync complete."
|
||||
|
||||
# Add changes to git
|
||||
cd "$REPO_PATH"
|
||||
echo "Adding changes to git..."
|
||||
git add --all
|
||||
git commit -m "update dotfiles"
|
||||
# git push
|
||||
|
||||
echo "----------------------------------------"
|
||||
echo "Dotfiles sync finished."
|
||||
echo "Review the changes and commit with:"
|
||||
echo "git commit -m \"update dotfiles\""
|
||||
echo "And push with: git push"
|
||||
echo "----------------------------------------"
|
||||
|
||||
Reference in New Issue
Block a user