#!/bin/zsh # ------------------------- # Editor # ------------------------- if command -v vim >/dev/null 2>&1; then export EDITOR=vim else export EDITOR=vi fi # ------------------------- # C / C++ compiler defaults # ------------------------- if command -v clang >/dev/null 2>&1; then export CC="$(command -v clang)" elif command -v gcc >/dev/null 2>&1; then export CC="$(command -v gcc)" fi if command -v clang++ >/dev/null 2>&1; then export CXX="$(command -v clang++)" elif command -v g++ >/dev/null 2>&1; then export CXX="$(command -v g++)" fi # ------------------------- # History # ------------------------- # Note: HISTCONTROL is bash-specific, but harmless. # ZSH history dedupe should usually be configured with setopt elsewhere. export HISTCONTROL=ignoredups # ------------------------- # User paths # ------------------------- path=("$HOME/bin" $path) path=("$HOME/.local/bin" $path) # ------------------------- # Go # ------------------------- if command -v go >/dev/null 2>&1; then export GOPATH="$HOME/.go" path=("$(go env GOPATH)/bin" $path) fi if [[ "$OSTYPE" == "linux-gnu"* ]]; then # If the Go install guide was followed for Linux, # /usr/local/go will contain the go binary. [[ -d "/usr/local/go/bin" ]] && path=("/usr/local/go/bin" $path) fi # ------------------------- # Ruby / RVM # ------------------------- if [[ -d "$HOME/.rvm/bin" ]]; then path=("$HOME/.rvm/bin" $path) fi # ----------------------------- # Rust / Cargo - Let rustup win # ----------------------------- if [[ -f "$HOME/.cargo/env" ]]; then . "$HOME/.cargo/env" fi if [[ -d "$HOME/.cargo/bin" ]]; then path=("$HOME/.cargo/bin" $path) fi # ------------------------- # OpenSSL fallback # ------------------------- if command -v openssl >/dev/null 2>&1; then export OPENSSL_BIN="$(command -v openssl)" fi