Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 13 additions & 7 deletions src/scripts/dev.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,23 @@ if [[ ! -d "$HOME/.local/share/nvim/site/pack/packer/start/packer.nvim" ]]; then
git clone https://github.com/wbthomason/packer.nvim "$HOME/.local/share/nvim/site/pack/packer/start/packer.nvim" 2>>"$ERROR_LOG_FILE" || true
fi

if [[ ! -d "$HOME/.config/nvim" ]] && [[ -d "$PROJECT_ROOT/src/dotfiles/nvim" ]]; then
mkdir -p "$HOME/.config" 2>>"$ERROR_LOG_FILE" || true
cp -r "$PROJECT_ROOT/src/dotfiles/nvim" "$HOME/.config/nvim" 2>>"$ERROR_LOG_FILE" || true
DOTFILES_ROOT="$PROJECT_ROOT/src/dotfiles"

if [[ -d "$DOTFILES_ROOT/config" ]]; then
copy_directory_safe "$DOTFILES_ROOT/config/nvim" "$HOME/.config/nvim"
copy_directory_safe "$DOTFILES_ROOT/config/fastfetch" "$HOME/.config/fastfetch"
copy_directory_safe "$DOTFILES_ROOT/config/btop" "$HOME/.config/btop"
copy_directory_safe "$DOTFILES_ROOT/config/alacritty" "$HOME/.config/alacritty"
copy_directory_safe "$DOTFILES_ROOT/config/kitty" "$HOME/.config/kitty"
copy_directory_safe "$DOTFILES_ROOT/config/zellij" "$HOME/.config/zellij"
fi

if [[ ! -f "$HOME/.vimrc" ]] && [[ -f "$PROJECT_ROOT/src/dotfiles/vim/.vimrc" ]]; then
copy_file_safe "$PROJECT_ROOT/src/dotfiles/vim/.vimrc" "$HOME/.vimrc"
if [[ -d "$DOTFILES_ROOT/home" ]]; then
copy_file_safe "$DOTFILES_ROOT/home/.vimrc" "$HOME/.vimrc"
fi

if [[ ! -f "$HOME/Library/Application Support/Code/User/settings.json" ]] && [[ -f "$PROJECT_ROOT/src/dotfiles/vs-code/settings.json" ]]; then
copy_file_safe "$PROJECT_ROOT/src/dotfiles/vs-code/settings.json" "$HOME/Library/Application Support/Code/User/settings.json"
if [[ ! -f "$HOME/Library/Application Support/Code/User/settings.json" ]] && [[ -f "$DOTFILES_ROOT/vs-code/settings.json" ]]; then
copy_file_safe "$DOTFILES_ROOT/vs-code/settings.json" "$HOME/Library/Application Support/Code/User/settings.json"
fi

git config --global credential.helper store 2>>"$ERROR_LOG_FILE" || true
Expand Down
25 changes: 19 additions & 6 deletions src/scripts/shell.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,29 @@ brew install jandedobbeleer/oh-my-posh/oh-my-posh 2>>"$ERROR_LOG_FILE" || true
brew install ghostty zsh tmux zsh-autosuggestions zsh-syntax-highlighting 2>>"$ERROR_LOG_FILE" || true
brew install --cask font-awesome-terminal-fonts font-fira-code font-meslo-lg-nerd-font font-powerline-symbols 2>>"$ERROR_LOG_FILE" || true

if [[ ! -f "$HOME/.config/ghostty/config" ]] && [[ -f "$PROJECT_ROOT/src/dotfiles/ghostty/config" ]]; then
copy_file_safe "$PROJECT_ROOT/src/dotfiles/ghostty/config" "$HOME/.config/ghostty/config"
DOTFILES_ROOT="$PROJECT_ROOT/src/dotfiles"

if [[ -d "$DOTFILES_ROOT/config" ]]; then
copy_directory_safe "$DOTFILES_ROOT/config/ghostty" "$HOME/.config/ghostty"
copy_directory_safe "$DOTFILES_ROOT/config/oh-my-posh" "$HOME/.config/oh-my-posh"
fi

if [[ ! -f "$HOME/.tmux.conf" ]] && [[ -f "$PROJECT_ROOT/src/dotfiles/tmux/.tmux.conf" ]]; then
copy_file_safe "$PROJECT_ROOT/src/dotfiles/tmux/.tmux.conf" "$HOME/.tmux.conf"
if [[ -d "$DOTFILES_ROOT/home" ]]; then
copy_file_safe "$DOTFILES_ROOT/home/.tmux.conf" "$HOME/.tmux.conf"
copy_file_safe "$DOTFILES_ROOT/home/.zshrc" "$HOME/.zshrc"
fi

if [[ ! -f "$HOME/.zshrc" ]] && [[ -f "$PROJECT_ROOT/src/dotfiles/oh-my-posh/.zshrc" ]]; then
copy_file_safe "$PROJECT_ROOT/src/dotfiles/oh-my-posh/.zshrc" "$HOME/.zshrc"
# home/.zshrc reads this cache to resolve DOTFILES and source home/zsh/<os>.zsh.
if [[ -d "$DOTFILES_ROOT/home/zsh" ]]; then
if [[ ! -f "$HOME/.dotfiles_path" ]]; then
printf '%s\n' "$DOTFILES_ROOT" > "$HOME/.dotfiles_path"
else
existing_dotfiles_root=""
IFS= read -r existing_dotfiles_root < "$HOME/.dotfiles_path" || true
if [[ -z "$existing_dotfiles_root" ]] || [[ ! -d "$existing_dotfiles_root/home/zsh" ]]; then
printf '%s\n' "$DOTFILES_ROOT" > "$HOME/.dotfiles_path"
fi
fi
fi

chsh -s "$(command -v zsh)" 2>>"$ERROR_LOG_FILE" || true
Expand Down
Loading