dotfiles/sync

55 lines
1.1 KiB
Fish
Executable File

#!/usr/bin/env fish
echo 'Syncing configuration files to your home dir...'
set_color grey
set -l fwd (pwd)
set -l cwd (string match -r '\w+$' $fwd)
if test ! "$cwd" = 'dotfiles'
cd /var/tmp
git clone --recurse-submodules https://github.com/mitchell/dotfiles.git
cd ./dotfiles
echo
end
if ! test -e ~/.config; mkdir ~/.config; end
rsync -aP ./.config/fish ~/.config/
rsync -aP ./.config/kitty ~/.config/
rsync -aP ./.config/nvim ~/.config/
rsync -aP ./.gitconfig ~/
rsync -aP ./.tmux* ~/
rsync -aP ./.vim* ~/
rsync -aP ./.ideavimrc ~/
rsync -aP ./.yabairc ~/
rsync -aP ./.skhdrc ~/
echo
fisher
set_color normal
set -l prompt 'Would you like to set your git user name and email?'
set -l set_git_user (read -p "set_color red; printf '\n$prompt (Y/n) '; set_color normal")
if test -z "$set_git_user"; or test "$set_git_user" = 'y'; or test "$set_git_user" = 'Y'
set -l name (read -P 'name: ')
git config --global user.name $name
set -l email (read -P 'email: ')
git config --global user.email $email
end
if test ! "$cwd" = 'dotfiles'
cd ..
rm -rf ./dotfiles
cd $fwd
end
echo -s \n 'Done syncing.'