Skip to content

Instantly share code, notes, and snippets.

@kenjikato
Last active November 1, 2021 07:50
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kenjikato/ecf864660f9706441b1434fa112db525 to your computer and use it in GitHub Desktop.
Save kenjikato/ecf864660f9706441b1434fa112db525 to your computer and use it in GitHub Desktop.
.zshrc-for-macos
# An enhanced .zshrc for macOS
#
# =====================================
# MAKE THE TERMINAL LOOK MORE COLORFUL
# =====================================
# Load the colors functionality into zsh. Go here to learn more about colors: https://unix.stackexchange.com/questions/19498/understanding-colors-in-zsh
autoload -Uz colors && colors #Want to know about autoload go here: https://stackoverflow.com/questions/30840651/what-does-autoload-do-in-zsh
# set a fancy prompt (non-color, unless we know we "want" color)
case "$TERM" in
xterm-color | *-256color) color_prompt=yes ;;
esac
if [[ "$color_prompt" = yes ]]; then
PS1="%{$fg_bold[cyan]%}%n@%m%{%f%}:%{$fg_bold[magenta]%}%~%{$reset_color%}%# "
else
PS1="%n@%m:%~%# "
fi
unset color_prompt
export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01'
export LS_OPTIONS='--color=auto'
export CLICOLOR=1
export LSCOLORS='EhgxfxdacxDaDaxbadacex'
export LS_COLORS='di=35;103:ln=36;40:so=35;40:pi=33;40:ex=32;40:bd=1;33;40:cd=1;33;40:su=0;41:sg=0;43:tw=0;42:ow=34;40:'
alias ls='ls -lGH'
alias grep='grep --colour=auto'
alias fgrep='fgrep --colour=auto'
alias egrep='egrep --colour=auto'
# =================
# SHELL COMPLETION
# =================
# Use modern completion system
autoload -Uz compinit && compinit -i # ignore permission differences in macOS
# Best example of using this is found here https://superuser.com/questions/290500/zsh-completion-colors-and-os-x
zstyle ':completion:*:default' list-colors 'di=35;103:ln=36;40:so=35;40:pi=33;40:ex=32;40:bd=1;33;40:cd=1;33;40:su=0;41:sg=0;43:tw=0;42:ow=34;40:'
# zstyle ':completion:*' list-colors 'di=35;103:ln=36;40:so=35;40:pi=33;40:ex=32;40:bd=1;33;40:cd=1;33;40:su=0;41:sg=0;43:tw=0;42:ow=34;40:'
zstyle ':completion:*' auto-description 'specify: %d'
zstyle ':completion:*' completer _expand _complete _correct _approximate
zstyle ':completion:*' format 'Completing %d'
zstyle ':completion:*' group-name ''
zstyle ':completion:*' menu select=2
zstyle ':completion:*' list-prompt %SAt %p: Hit TAB for more, or the character to insert%s
zstyle ':completion:*' matcher-list '' 'm:{a-z}={A-Z}' 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=* r:|=* l:|=*'
zstyle ':completion:*' menu select=long
zstyle ':completion:*' select-prompt %SScrolling active: current selection at %p%s
zstyle ':completion:*' use-compctl false
zstyle ':completion:*' verbose true
zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#)*=0=01;31'
zstyle ':completion:*:kill:*' command 'ps -u $USER -o pid,%cpu,tty,cputime,comm'
autoload -U +X bashcompinit && bashcompinit # Bash completion compatibility
# ============
# ALIAS SETUP
# ============
alias branch="echo \$(git symbolic-ref HEAD | sed -e 's,.*/\(.*\),\1,')"
# ===============
# WELCOME MESSAGE
echo "Welcome coder 👨🏻‍💻"
# ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
# Below this point are configs that are not part of my standard .zshrc file that is on github under this gist:
# https://gist.github.com/kenjikato/ecf864660f9706441b1434fa112db525
# ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment