From 07a805ea2f5a562d1835cbd9a27bc882362ffee2 Mon Sep 17 00:00:00 2001 From: Seth Etter Date: Mon, 29 Dec 2025 16:15:37 -0600 Subject: [PATCH] zsh: starship config, enable direnv --- setup.sh | 110 +++++++++++++++++++++++----------------------- zsh/starship.toml | 2 + zsh/zshrc | 3 ++ 3 files changed, 61 insertions(+), 54 deletions(-) create mode 100644 zsh/starship.toml diff --git a/setup.sh b/setup.sh index fa4b968..4c7ea1d 100755 --- a/setup.sh +++ b/setup.sh @@ -5,77 +5,79 @@ set -euo pipefail DOTFILES_DIR="$HOME/dotfiles" function link_configs { - echo "Linking configuration files..." + echo "Linking configuration files..." - declare -A mappings + declare -A mappings - # TODO: Make this linux compatible - mappings["ghostty"]="$HOME/Library/Application Support/com.mitchellh.ghostty" - mappings["zsh/zshenv"]="$HOME/.zshenv" - mappings["zsh/zshrc"]="$HOME/.zshrc" - mappings["misc/tmux.conf"]="$HOME/.tmux.conf" - mappings["git/gitconfig"]="$HOME/.gitconfig" - mappings["git/gitignore"]="$HOME/.gitignore" - mappings["misc/vimrc"]="$HOME/.vimrc" - mappings["nvim"]="$HOME/.config/nvim" - mappings["glide"]="$HOME/.config/glide" - mappings["misc/global-tool-versions"]="$HOME/.tool-versions" - mappings["ai/skills"]="$HOME/.claude/skills" + # TODO: Make this linux compatible + mappings["ghostty"]="$HOME/Library/Application Support/com.mitchellh.ghostty" + mappings["zsh/zshenv"]="$HOME/.zshenv" + mappings["zsh/zshrc"]="$HOME/.zshrc" + mappings["misc/tmux.conf"]="$HOME/.tmux.conf" + mappings["git/gitconfig"]="$HOME/.gitconfig" + mappings["git/gitignore"]="$HOME/.gitignore" + mappings["misc/vimrc"]="$HOME/.vimrc" + mappings["nvim"]="$HOME/.config/nvim" + mappings["glide"]="$HOME/.config/glide" + mappings["misc/global-tool-versions"]="$HOME/.tool-versions" + mappings["ai/skills"]="$HOME/.claude/skills" + mappings["hammerspoon"]="$HOME/.hammerspoon" + mappings["zsh/starship.toml"]="$HOME/.config/starship.toml" - for key in "${!mappings[@]}"; do - source="${key}" - destination="${mappings[$key]}" + for key in "${!mappings[@]}"; do + source="${key}" + destination="${mappings[$key]}" - if [ -d "$source" ]; then - mkdir -p "$(dirname "$destination")" - create_symlink "$source" "$destination" - elif [ -f "$source" ]; then - create_symlink "$source" "$destination" - else - echo "Warning: Source $source does not exist, skipping." - fi - done + if [ -d "$source" ]; then + mkdir -p "$(dirname "$destination")" + create_symlink "$source" "$destination" + elif [ -f "$source" ]; then + create_symlink "$source" "$destination" + else + echo "Warning: Source $source does not exist, skipping." + fi + done } function create_symlink { - local source="$1" - local destination="$2" + local source="$1" + local destination="$2" - echo "$source -> $destination" + echo "$source -> $destination" - if [ -L "$destination" ]; then - if [ "$(readlink "$destination")" = "$DOTFILES_DIR/$source" ]; then - echo " Already established" - return - else - echo " Removing existing symlink ($(readlink "$destination"))" - rm "$destination" - fi - fi + if [ -L "$destination" ]; then + if [ "$(readlink "$destination")" = "$DOTFILES_DIR/$source" ]; then + echo " Already established" + return + else + echo " Removing existing symlink ($(readlink "$destination"))" + rm "$destination" + fi + fi - if [ -e "$destination" ]; then - echo " Destination exists, backing it up" - mv "$destination" "${destination}.bak" - fi + if [ -e "$destination" ]; then + echo " Destination exists, backing it up" + mv "$destination" "${destination}.bak" + fi - echo " Creating symlink" - ln -s "$DOTFILES_DIR/$source" "$destination" + echo " Creating symlink" + ln -s "$DOTFILES_DIR/$source" "$destination" } function install_oh_my_zsh { - if [ -d "$HOME/.oh-my-zsh" ]; then - echo "Oh My Zsh is already installed." - return - fi - sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended + if [ -d "$HOME/.oh-my-zsh" ]; then + echo "Oh My Zsh is already installed." + return + fi + sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended } function install_tpm { - if [ -d "$HOME/.tmux/plugins/tpm" ]; then - echo "TPM is already installed." - return - fi - git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm + if [ -d "$HOME/.tmux/plugins/tpm" ]; then + echo "TPM is already installed." + return + fi + git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm } link_configs diff --git a/zsh/starship.toml b/zsh/starship.toml new file mode 100644 index 0000000..79ac086 --- /dev/null +++ b/zsh/starship.toml @@ -0,0 +1,2 @@ +[direnv] +disabled = false diff --git a/zsh/zshrc b/zsh/zshrc index 17682eb..5899d0c 100644 --- a/zsh/zshrc +++ b/zsh/zshrc @@ -11,6 +11,9 @@ eval "$(starship init zsh)" # fzf source <(fzf --zsh) +# direnv +eval "$(direnv hook zsh)" + # 1password cli plugins [ -f "/Users/sethetter/.config/op/plugins.sh" ] && source /Users/sethetter/.config/op/plugins.sh -- 2.51.2