diff --git a/platforms/mac/Microsoft.PowerShell_profile.ps1 b/platforms/mac/pwshProfile.ps1 similarity index 100% rename from platforms/mac/Microsoft.PowerShell_profile.ps1 rename to platforms/mac/pwshProfile.ps1 diff --git a/platforms/mac/zshrc b/platforms/mac/zshrc index cf41274..bf3d429 100644 --- a/platforms/mac/zshrc +++ b/platforms/mac/zshrc @@ -4,9 +4,6 @@ # Sourced by user's zshrc if is macOS 在用户的 zshrc 中被引用,macOS 特定配置 # Entry point in $DOTFILES/tools/zsh/common.zshrc (入口点) -# Homebrew Path -export PATH=/opt/homebrew/bin:/opt/homebrew/sbin:$PATH - # macOS # alias xclip="pbcopy" diff --git a/tools/zsh/mod/config.zsh b/tools/zsh/mod/config.zsh index 20ec160..f8cd08b 100644 --- a/tools/zsh/mod/config.zsh +++ b/tools/zsh/mod/config.zsh @@ -36,8 +36,7 @@ done set -k # TODO: Below should be reorganized -export PATH=$HOME/bin:$HOME/.local/bin:/usr/local/bin:$PATH -export PATH=$HOME/.local/share/gem/ruby/3.3.0/bin:$PATH # Ruby Executables +export PATH=$HOME/.local/bin:$PATH export NVM_DIR="$HOME/.config/nvm" [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm diff --git a/tools/zsh/zshenv b/tools/zsh/zshenv index d390a44..e78aa31 100644 --- a/tools/zsh/zshenv +++ b/tools/zsh/zshenv @@ -33,6 +33,15 @@ export PAGER="less -R" export EDITOR="nvim" export VISUAL="nvim" +# Minimal PATH for early commands +export PATH="/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:$PATH" + +if [ -d "/opt/homebrew/bin" ]; then # macOS + export PATH="/opt/homebrew/bin:$PATH" +elif [ -d "/home/linuxbrew/.linuxbrew/bin" ]; then # Linux + export PATH="/home/linuxbrew/.linuxbrew/bin:$PATH" +fi + # macOS Specific # This syntax is POSIX standard, for portability if [ "$(uname)" = "Darwin" ]; then @@ -52,6 +61,7 @@ fi # Cargo if command -v cargo > /dev/null; then export CARGO_HOME="$XDG_DATA_HOME"/cargo + export PATH="$CARGO_HOME/bin:$PATH" fi # CGDB if command -v cgdb > /dev/null; then @@ -60,6 +70,7 @@ fi # .NET if command -v dotnet > /dev/null; then export DOTNET_CLI_HOME="$XDG_DATA_HOME"/dotnet + export PATH="$DOTNET_CLI_HOME/.dotnet/tools:$PATH" fi # Docker if command -v docker > /dev/null; then @@ -72,6 +83,7 @@ fi # Go if command -v go > /dev/null; then export GOPATH="$XDG_DATA_HOME"/go + export PATH="$GOPATH/bin:$PATH" fi # Julia if command -v julia > /dev/null; then @@ -100,6 +112,17 @@ if command -v screen > /dev/null; then export SCREENRC="$XDG_CONFIG_HOME"/screen/screenrc export SCREENDIR="${XDG_RUNTIME_DIR}/screen" fi +# Ruby Gem +# Ruby Gem +if command -v gem > /dev/null; then + setopt nullglob + for dir in "$HOME/.local/share/gem/ruby/"*/bin; do + if [ -d "$dir" ]; then + export PATH="$dir:$PATH" + fi + done + unsetopt nullglob +fi # Spacemacs if command -v emacs > /dev/null; then export SPACEMACSDIR="$XDG_CONFIG_HOME"/spacemacs