path.zsh 1.0 KB

1234567891011121314151617181920212223242526272829
  1. # Optimized PATH setup - combine all additions into single operation
  2. # Build PATH array and export once (faster than multiple exports)
  3. local new_path_dirs=(
  4. "/usr/local/texlive/2024/bin/x86_64-linux"
  5. "$HOME/.local/bin"
  6. "$HOME/.bin"
  7. "$HOME/.dotnet/tools"
  8. "$HOME/.local/share/npm/bin"
  9. "$HOME/.local/share/cargo/bin"
  10. "$HOME/.local/share/go/bin"
  11. "$HOME/.local/share/flatpak/exports/share"
  12. "$HOME/AppImages/"
  13. "/var/lib/flatpak/exports/share"
  14. )
  15. # Build PATH only with directories that exist (single loop, single export)
  16. local new_path=""
  17. for dir in "${new_path_dirs[@]}"; do
  18. [[ -d "$dir" ]] && new_path="${new_path:+$new_path:}$dir"
  19. done
  20. # Export PATH once if we have additions
  21. [[ -n "$new_path" ]] && export PATH="$new_path:$PATH"
  22. # Set MANPATH and INFOPATH if texlive directory exists
  23. [[ -d "/usr/local/texlive/2024/texmf-dist/doc/man" ]] && {
  24. export MANPATH="/usr/local/texlive/2024/texmf-dist/doc/man:${MANPATH:-}"
  25. export INFOPATH="/usr/local/texlive/2024/texmf-dist/doc/info:${INFOPATH:-}"
  26. }