Last active
September 20, 2025 19:46
-
-
Save akunzai/616796de59282c8bfdae3005511c588e to your computer and use it in GitHub Desktop.
My ZSH profile
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://www.cyberciti.biz/faq/apple-mac-osx-terminal-color-ls-output-option/ | |
export CLICOLOR=1 | |
export EDITOR=vi | |
export LC_ALL=en_US.UTF-8 | |
export LANG=en_US.UTF-8 | |
# Avoid the `._*` files in tar | |
# https://superuser.com/a/61188 | |
export COPYFILE_DISABLE=1 | |
# https://learn.microsoft.com/dotnet/core/tools/dotnet-environment-variables#dotnet_cli_ui_language | |
export DOTNET_CLI_UI_LANGUAGE='en-us' | |
# https://learn.microsoft.com/aspnet/core/fundamentals/environments | |
export DOTNET_ENVIRONMENT=Development | |
export ASPNETCORE_ENVIRONMENT=Development | |
# https://github.com/dotnet/runtime/issues/68018 | |
export DOTNET_ReadyToRun=0 | |
# https://docs.npmjs.com/cli/v11/using-npm/config | |
export NPM_CONFIG_FUND=false | |
export NPM_CONFIG_AUDIT=false | |
export NPM_CONFIG_IGNORE_SCRIPTS=true | |
# https://nodejs.dev/en/learn/nodejs-the-difference-between-development-and-production/ | |
export NODE_ENV=development |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://docs.brew.sh/FAQ#why-should-i-install-homebrew-in-the-default-location | |
if [[ $(uname -m) == 'arm64' ]]; then | |
eval "$(/opt/homebrew/bin/brew shellenv)" | |
else | |
eval "$(/usr/local/bin/brew shellenv)" | |
fi | |
# https://www.topbug.net/blog/2016/10/11/speed-test-check-the-existence-of-a-command-in-bash-and-zsh/ | |
if [[ (( $+commands[brew] )) ]]; then | |
# https://docs.brew.sh/Shell-Completion#configuring-completions-in-zsh | |
FPATH="$HOMEBREW_PREFIX/share/zsh/site-functions:$FPATH" | |
# https://rust-lang.github.io/rustup/installation/index.html#enable-tab-completion-for-bash-fish-zsh-or-powershell | |
fpath+=~/.zfunc | |
autoload -Uz compinit | |
compinit | |
# https://github.com/zsh-users/zsh-autosuggestions | |
[ -e "$HOMEBREW_PREFIX/share/zsh-autosuggestions/zsh-autosuggestions.zsh" ] && . "$HOMEBREW_PREFIX/share/zsh-autosuggestions/zsh-autosuggestions.zsh" | |
# https://github.com/zdharma-continuum/fast-syntax-highlighting | |
[ -e "$HOMEBREW_PREFIX/opt/zsh-fast-syntax-highlighting" ] && . "$HOMEBREW_PREFIX/opt/zsh-fast-syntax-highlighting/share/zsh-fast-syntax-highlighting/fast-syntax-highlighting.plugin.zsh" | |
# https://github.com/jeffreytse/zsh-vi-mode | |
[ -e "$HOMEBREW_PREFIX/opt/zsh-vi-mode/share/zsh-vi-mode/zsh-vi-mode.plugin.zsh" ] && . "$HOMEBREW_PREFIX/opt/zsh-vi-mode/share/zsh-vi-mode/zsh-vi-mode.plugin.zsh" | |
fi | |
# Replace docker with podman | |
if command -v podman &>/dev/null && ! command -v docker &>/dev/null; then | |
alias docker=podman | |
fi | |
# https://ohmyposh.dev/ | |
if [[ -x "$HOMEBREW_PREFIX/bin/oh-my-posh" ]]; then | |
eval "$(oh-my-posh init zsh --config dracula)" | |
enable_poshtransientprompt | |
fi | |
# https://code.visualstudio.com/docs/setup/mac#_launching-from-the-command-line | |
if [[ -d '/Applications/Visual Studio Code.app/Contents/Resources/app/bin' ]]; then | |
export PATH="$PATH:/Applications/Visual Studio Code.app/Contents/Resources/app/bin" | |
[ -z "$VISUAL" ] && export VISUAL=code | |
fi | |
# https://youtrack.jetbrains.com/issue/TBX-7889 | |
[[ -d "$HOME/Library/Application Support/JetBrains/Toolbox/scripts" ]] && export PATH="$PATH:$HOME/Library/Application Support/JetBrains/Toolbox/scripts" | |
# https://github.com/dotnet/sdk/issues/9415 | |
[[ -d "$HOME/.dotnet/tools" ]] && export PATH="$PATH:$HOME/.dotnet/tools" | |
# https://docs.astral.sh/uv/reference/installer/ | |
if command -v uv &>/dev/null; then | |
eval "$(uv generate-shell-completion zsh)" | |
alias python='uv run' | |
fi | |
XDG_BIN_HOME=${XDG_BIN_HOME:-$HOME/.local/bin} | |
[[ -d "$XDG_BIN_HOME" ]] && export PATH="$PATH:$XDG_BIN_HOME" | |
[[ -e "$HOME/.venv/bin/activate" ]] && source $HOME/.venv/bin/activate | |
[[ -d "$HOMEBREW_PREFIX/opt/ruby/bin" ]] && export PATH="$HOMEBREW_PREFIX/opt/ruby/bin:$PATH" | |
# https://blog.miniasp.com/post/2020/05/04/How-to-use-GPG-sign-git-commit-and-tag-object | |
[[ -x "$HOMEBREW_PREFIX/bin/gpg-agent" ]] && export GPG_TTY=$(tty) | |
# https://remysharp.com/2018/08/23/cli-improved | |
if [[ -x "$HOMEBREW_PREFIX/bin/bat" ]]; then | |
export BAT_THEME='Dracula' | |
alias cat='bat' | |
alias less='bat' | |
fi | |
# https://github.com/nvm-sh/nvm | |
if [[ -e "$HOMEBREW_PREFIX/opt/nvm" ]]; then | |
[ -e "$HOME/.nvm" ] || mkdir "$HOME/.nvm" | |
export NVM_DIR="$HOME/.nvm" | |
[ -s "$HOMEBREW_PREFIX/opt/nvm/nvm.sh" ] && source "$HOMEBREW_PREFIX/opt/nvm/nvm.sh" # This loads nvm | |
[ -s "$HOMEBREW_PREFIX/opt/nvm/etc/bash_completion.d/nvm" ] && source "$HOMEBREW_PREFIX/opt/nvm/etc/bash_completion.d/nvm" # This loads nvm bash_completion | |
autoload -U add-zsh-hook | |
load-nvmrc() { | |
local node_version="$(nvm version)" | |
local nvmrc_path="$(nvm_find_nvmrc)" | |
if [ -n "$nvmrc_path" ]; then | |
local nvmrc_node_version=$(nvm version "$(cat "${nvmrc_path}")") | |
if [ "$nvmrc_node_version" = "N/A" ]; then | |
nvm install | |
elif [ "$nvmrc_node_version" != "$node_version" ]; then | |
nvm use | |
fi | |
elif [ "$node_version" != "$(nvm version default)" ]; then | |
echo "Reverting to nvm default version" | |
nvm use default | |
fi | |
} | |
add-zsh-hook chpwd load-nvmrc | |
load-nvmrc | |
fi | |
# https://direnv.net/ | |
command -v direnv &>/dev/null && eval "$(direnv hook zsh)" | |
# https://developer.chrome.com/blog/headless-chrome | |
if [[ -e '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome' ]]; then | |
alias chrome='/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome' | |
# Make sure all chrome processes are killed before running the command | |
alias chrome-unsafe='chrome --user-data-dir="/tmp/chrome-dev-data" --disable-xss-auditor --disable-web-security --disable-site-isolation-trials --disable-features=Translate' | |
fi | |
if [[ -d "$HOMEBREW_PREFIX/share/google-cloud-sdk" ]]; then | |
source "$HOMEBREW_PREFIX/share/google-cloud-sdk/path.zsh.inc" | |
source "$HOMEBREW_PREFIX/share/google-cloud-sdk/completion.zsh.inc" | |
command -v python3 &>/dev/null && export CLOUDSDK_PYTHON="$(command -v python3)" | |
fi | |
if [[ -d "$HOME/Library/Android/sdk/platform-tools" ]]; then | |
export PATH="$PATH:$HOME/Library/Android/sdk/platform-tools" | |
fi | |
# https://github.com/dotnet/runtime/issues/46071 | |
if [[ -d "$HOMEBREW_PREFIX/opt/openssl@3/lib" ]]; then | |
export DYLD_LIBRARY_PATH=$HOMEBREW_PREFIX/opt/openssl@3/lib | |
fi | |
# https://jimkang.medium.com/install-go-on-mac-with-homebrew-5fa421fc55f5 | |
if [[ -e "$HOMEBREW_PREFIX/opt/go/libexec" ]]; then | |
export GOROOT="$HOMEBREW_PREFIX/opt/go/libexec" | |
export GOPATH="$HOME/go" | |
[[ -e $GOROOT/bin ]] && export PATH="$PATH:$GOROOT/bin" | |
[[ -e $GOPATH/bin ]] && export PATH="$PATH:$GOPATH/bin" | |
fi | |
# https://ngrok.com/docs/secure-tunnels/ngrok-agent/reference/ngrok/#ngrok-completion | |
command -v ngrok &>/dev/null && eval "$(ngrok completion)" | |
# https://pnpm.io/installation#using-a-shorter-alias | |
if command -v pnpm &>/dev/null ; then | |
alias pn=pnpm | |
export PNPM_HOME="$HOME/Library/pnpm" | |
case ":$PATH:" in | |
*":$PNPM_HOME:"*) ;; | |
*) export PATH="$PNPM_HOME:$PATH" ;; | |
esac | |
fi | |
# This gives you better history searching | |
export HISTSIZE=1000000 | |
export SAVEHIST=1000000 | |
setopt HIST_IGNORE_ALL_DUPS | |
setopt HIST_FIND_NO_DUPS | |
setopt HIST_REDUCE_BLANKS | |
alias hg='history | grep' | |
alias ls='ls -G' | |
alias ll='ls -lG' | |
# https://hub.docker.com/_/composer | |
alias composer='podman run -it --rm -e PHP_CS_FIXER_IGNORE_ENV=1 -v $PWD:/app -v ${COMPOSER_HOME:-$HOME/.composer}:/tmp composer' | |
# https://github.com/wagoodman/dive | |
alias dive='podman run -ti --rm -v /var/run/docker.sock:/var/run/docker.sock wagoodman/dive' | |
# https://github.com/phpstan/phpstan/pkgs/container/phpstan | |
alias phpstan='podman run -it --rm --init -v $PWD:/app ghcr.io/phpstan/phpstan' | |
# https://hub.docker.com/r/oskarstark/php-cs-fixer-ga | |
alias php-cs-fixer='podman run -it --rm --init -v $PWD:/app -w /app --entrypoint='' oskarstark/php-cs-fixer-ga php-cs-fixer' | |
# https://hub.docker.com/r/instrumentisto/nmap | |
alias nmap='podman run -it --rm instrumentisto/nmap' | |
# https://hub.docker.com/r/curlimages/curl | |
alias ccurl='podman run -it --rm curlimages/curl' | |
alias net.stats='lsof -Pni' | |
alias dns.flush='sudo killall -HUP mDNSResponder' | |
function up() { | |
brew update && brew upgrade | |
} | |
function rgit() { find . -name '.git' -execdir bash -c "pwd && git $@" \; } | |
# https://docs.gitignore.io/install/command-line | |
function gi() { curl -sLw "\n" https://www.toptal.com/developers/gitignore/api/$@ ;} | |
# https://stackoverflow.com/a/24657630 | |
function jver(){ | |
if [ -n "$1" ]; then | |
export JAVA_HOME=$(/usr/libexec/java_home -v $1) | |
else | |
/usr/libexec/java_home -V | |
fi | |
java -version | |
} | |
# https://gist.github.com/thomasdarimont/46358bc8167fce059d83a1ebdb92b0e7 | |
function jwt_decode(){ | |
jq -R 'split(".") | .[1] | @base64d | fromjson' <<< "$1" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment