#!/bin/bash # curl -sL "https://vim.chan15.info/download/get_shell_tools.sh" | bash yellow='\033[1;33m' no_color='\033[0m' # No Color if [[ "$(uname -s)" != "Darwin" ]]; then echo "This script only supports macOS." exit 1 fi if ! command -v brew >/dev/null 2>&1; then echo "Homebrew is required. Install it from https://brew.sh, then run this script again." exit 1 fi echo "Installing zsh-autosuggestions zsh-syntax-highlighting fzf zoxide bat jq..." brew install zsh-autosuggestions zsh-syntax-highlighting fzf zoxide bat jq zshrc="$HOME/.zshrc" [[ -f "$zshrc" ]] || touch "$zshrc" added=0 append_if_missing() { local line="$1" if ! grep -Fqx "$line" "$zshrc" 2>/dev/null; then echo -e "\n$line" >> "$zshrc" added=1 fi } # gray-text history suggestions append_if_missing 'source "$(brew --prefix)/share/zsh-autosuggestions/zsh-autosuggestions.zsh"' # fuzzy finder shell integration (Ctrl-R history, Ctrl-T file search, etc.) append_if_missing 'eval "$(fzf --zsh)"' # smart cd append_if_missing 'eval "$(zoxide init zsh)"' # command/argument syntax highlighting must be sourced last append_if_missing 'source "$(brew --prefix)/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh"' if [[ "$added" -eq 1 ]]; then echo -e "${yellow}Updated $zshrc. Please run 'source $zshrc' or restart your terminal to activate it.${no_color}" else echo -e "${yellow}$zshrc already configured, nothing to add.${no_color}" fi echo -e "${yellow}Shell tools installed and configured.${no_color}"