Skip to content

Instantly share code, notes, and snippets.

@ashpreetbedi
Created December 29, 2024 12:12
Show Gist options
  • Save ashpreetbedi/85b58d31b0ab09d24513e0aeb451d800 to your computer and use it in GitHub Desktop.
Save ashpreetbedi/85b58d31b0ab09d24513e0aeb451d800 to your computer and use it in GitHub Desktop.
zshrc configuration
# Activate subl command by adding Sublime Text path to PATH
SUBL_PATH="/Applications/Sublime Text.app/Contents/SharedSupport/bin"
# Add Bun to path
export BUN_INSTALL="$HOME/.bun"
# Add global python to path
GLOBAL_PYTHON_PATH="/opt/homebrew/bin/python3.13"
export PATH=$GLOBAL_PYTHON_PATH:/opt/homebrew/bin:/usr/local/bin:$SUBL_PATH:$BUN_INSTALL/bin:$PATH
# enable direnv i.e. load env vars from a .envrc file in the current and parent directories.
eval "$(direnv hook zsh)"
# zsh theme
export ZSH=$HOME/.oh-my-zsh
ZSH_THEME="bedizsh"
ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE="fg=#b8a2ff"
# Disable auto-cd so commands matching a directory name don't cd into it
unsetopt autocd
COMPLETION_WAITING_DOTS="true"
# Uncomment the following line if you want to disable marking untracked files
# under VCS as dirty. This makes repository status check for large repositories
# much, much faster.
DISABLE_UNTRACKED_FILES_DIRTY="true"
# Install the following plugins
plugins=(git python colorize zsh-syntax-highlighting zsh-autosuggestions kubectl kube-ps1)
source $ZSH/oh-my-zsh.sh
# kube-ps1
# use kubeon to activate
PROMPT='$(kube_ps1)'$PROMPT
export KUBE_PS1_SYMBOL_ENABLE="false"
# kubens
export KUBENS_CURRENT_FGCOLOR=$(tput setaf 6)
# Aliases
# Mac
alias showFiles='defaults write com.apple.finder AppleShowAllFiles YES; killall Finder /System/Library/CoreServices/Finder.app'
alias hideFiles='defaults write com.apple.finder AppleShowAllFiles NO; killall Finder /System/Library/CoreServices/Finder.app'
# Python
alias del_pyc='find . -type f -name "*.py[co]" -delete -or -type d -name "_pycache_" -delete'
# Git
function git_commit_push() {
if [ -z "$1" ]; then
COMMIT_MESSAGE="Updated at $(date +'%Y-%m-%d %H:%M:%S')"
else
COMMIT_MESSAGE="$1"
fi
git add .
git commit -m "${COMMIT_MESSAGE}"
git push
}
alias gcp='git_commit_push'
alias gcb='git checkout -t origin/main -b'
alias gca='git add . ; git commit --amend'
alias gcm='git checkout main'
alias gpm='git pull origin main'
alias gcd='git checkout dev'
alias gpd='git pull origin dev'
alias gcs='git checkout stg'
alias gps='git pull origin stg'
# Docker
alias dc='docker compose'
alias dm='docker-machine'
alias dl='$LAB_DIR/scripts/docker/docker_logs.sh'
alias dlt='docker logs --tail 200'
alias de='$LAB_DIR/scripts/docker/docker_exec.sh'
# K8s
alias kg='kubectl get'
alias kd='kubectl describe'
alias kx='kubectx'
alias kns='kubens'
# Tmux
alias ta='tmux a -t '
alias t='tmux'
# Custom
alias ll='ls -alh'
# To install key bindings and fuzzy completion for fzf
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh
# Bun completions
[ -s "/Users/zu/.bun/_bun" ] && source "/Users/zu/.bun/_bun"
# The next line updates PATH for the Google Cloud SDK.
if [ -f '/Users/zu/google-cloud-sdk/path.zsh.inc' ]; then . '/Users/zu/google-cloud-sdk/path.zsh.inc'; fi
# The next line enables shell command completion for gcloud.
if [ -f '/Users/zu/google-cloud-sdk/completion.zsh.inc' ]; then . '/Users/zu/google-cloud-sdk/completion.zsh.inc'; fi
############################################################################
#
# Custom zsh theme built from the mh theme
# Usage:
# - save this file to ~/.oh-my-zsh/custom/themes/bedizsh.zsh-theme
# - in ~/.zshrc, set ZSH_THEME="bedizsh"
# Features:
# - path is autoshortened to ~30 characters
# - displays git status (if applicable in current folder)
#
############################################################################
# prompt
PROMPT='[%{$fg[red]%}%30<...<%~%<<%{$reset_color%}]%(!.#.$) '
RPROMPT='$(git_prompt_info)'
# git theming
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg_bold[gray]%}(%{$fg_no_bold[yellow]%}%B"
ZSH_THEME_GIT_PROMPT_SUFFIX="%b%{$fg_bold[gray]%})%{$reset_color%} "
ZSH_THEME_GIT_PROMPT_CLEAN=""
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg_bold[red]%}✱"
# LS colors, made with https://geoff.greer.fm/lscolors/
export LSCOLORS="Gxfxcxdxbxegedabagacad"
export LS_COLORS='no=00:fi=00:di=01;34:ln=00;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=41;33;01:ex=00;32:*.cmd=00;32:*.exe=01;32:*.com=01;32:*.bat=01;32:*.btm=01;32:*.dll=01;32:*.tar=00;31:*.tbz=00;31:*.tgz=00;31:*.rpm=00;31:*.deb=00;31:*.arj=00;31:*.taz=00;31:*.lzh=00;31:*.lzma=00;31:*.zip=00;31:*.zoo=00;31:*.z=00;31:*.Z=00;31:*.gz=00;31:*.bz2=00;31:*.tb2=00;31:*.tz2=00;31:*.tbz2=00;31:*.avi=01;35:*.bmp=01;35:*.fli=01;35:*.gif=01;35:*.jpg=01;35:*.jpeg=01;35:*.mng=01;35:*.mov=01;35:*.mpg=01;35:*.pcx=01;35:*.pbm=01;35:*.pgm=01;35:*.png=01;35:*.ppm=01;35:*.tga=01;35:*.tif=01;35:*.xbm=01;35:*.xpm=01;35:*.dl=01;35:*.gl=01;35:*.wmv=01;35:*.aiff=00;32:*.au=00;32:*.mid=00;32:*.mp3=00;32:*.ogg=00;32:*.voc=00;32:*.wav=00;32:'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment