Last active
August 13, 2024 23:15
-
-
Save alexkrolick/e21835c2ab94b18e80848c420bc01170 to your computer and use it in GitHub Desktop.
.zshrc
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
# Installation | |
# | |
# MacOS | |
# | |
# mkdir ~/.zsh | |
# brew install zsh-syntax-highlighting zsh-completions | |
# touch ~/.zshrc | |
# touch ~/.profile | |
# | |
# Paste this file into `~/.zshrc` | |
# | |
# Making zsh the default shell if it is not already: | |
# chsh -s /bin/zsh $USER | |
# PRINT INFO ON LOGIN | |
echo $USER@$HOST | |
# Keep environment variables in generic profile so other shells can get them | |
source ~/.profile | |
# Setup ZSH | |
export HOMEBREW_REPOSITORY=$(brew --repository) | |
fpath=(~/$HOMEBREW_REPOSITORY/share/zsh-completions $fpath) | |
export HOMEBREW_NO_ANALYTICS=1 | |
# Aliases | |
alias lsd='ls -aFhlG' | |
alias l='ls -al' | |
alias ls='ls -GFh' # Colorize output, add file type indicator, and put sizes in human readable format | |
alias ll='ls -GFhl' # Same as above, but in long listing format | |
alias 'rm=rm -i' # make rm command (potentially) less destructive | |
alias tree="ls -R | grep ":$" | sed -e 's/:$//' -e 's/[^-][^\/]*\//--/g' -e 's/^/ /' -e 's/-/|/'" | |
alias ql='qlmanage -p 2>/dev/null' # OS X Quick Look | |
alias oo='open .' # open current directory in OS X Finder | |
alias f='find . -name' | |
alias grepe='grep -E -R' | |
alias gg='git grep -i' | |
alias g='git' | |
alias npr='npm run' | |
alias npmrun='npm run' | |
# Extensions | |
source /opt/homebrew/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh | |
source ~/.zsh/jira_completions.zsh | |
# Prompt | |
autoload -Uz vcs_info | |
setopt prompt_subst | |
zstyle ':vcs_info:*' enable git hg | |
zstyle ':vcs_info:git:*' get-revision true | |
zstyle ':vcs_info:*' check-for-changes true | |
zstyle ':vcs_info:*' use-server true | |
zstyle ':vcs_info:*' get-unapplied true | |
zstyle ':vcs_info:git:*' stagedstr '%F{green}•%f' | |
zstyle ':vcs_info:git:*' unstagedstr '%F{red}•%f' | |
zstyle ':vcs_info:*' actionformats \ | |
"%F{blue}%B%s%%b%f|%F{red}%a%f %F{green}%b%f %F{cyan}%6.6i%f %c%u %m" | |
zstyle ':vcs_info:*' formats \ | |
"%F{green}%b%f %F{cyan}%6.6i%f %c%u %m" | |
zstyle ':vcs_info:(sv[nk]|bzr):*' branchformat '%b%F{1}:%F{3}%r' | |
precmd () { vcs_info } | |
PS1='%F{magenta}%T %F{yellow}%~%f ${vcs_info_msg_0_} | |
%B%# %b' | |
# https://thevaluable.dev/zsh-completion-guide-examples/ | |
zstyle ':completion:*' menu select | |
zstyle ':completion:*' group-name '' | |
# zstyle ':completion:*' file-list all | |
zstyle ':completion:*:default' list-colors ${(s.:.)LS_COLORS} | |
zstyle ':completion:*' complete-options true | |
# zstyle ':completion:*' matcher-list '' 'm:{a-zA-Z}={A-Za-z}' | |
zstyle ':completion:*' matcher-list '' 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=* r:|=*' 'l:|=* r:|=*' | |
zstyle ':completion:*' verbose yes | |
# History: | |
setopt SHARE_HISTORY | |
setopt HIST_IGNORE_DUPS | |
setopt HIST_IGNORE_SPACE | |
export HISTFILESIZE=1000000000 | |
export HISTSIZE=11000000000 | |
export HISTFILE=~/.zsh_history | |
setopt HIST_FIND_NO_DUPS | |
# following should be turned off, if sharing history via setopt SHARE_HISTORY | |
setopt INC_APPEND_HISTORY | |
# UP/DOWN arrow searches history: | |
autoload -U up-line-or-beginning-search | |
autoload -U down-line-or-beginning-search | |
zle -N up-line-or-beginning-search | |
zle -N down-line-or-beginning-search | |
bindkey "^[[A" up-line-or-beginning-search # Up | |
bindkey "^[[B" down-line-or-beginning-search # Down | |
# setopt AUTO_COMPLETE | |
# setopt AUTO_PARAM_SLASH | |
# setopt COMPLETE_IN_WORD | |
# setopt LIST_ROWS_FIRST |
If you have AWS CLI installed, add this to the end of the file:
source /usr/local/bin/aws_zsh_completer.sh
FNM integration for managing Node versions:
eval "$(fnm env --use-on-cd --shell zsh)"
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The prompt looks like this, where the red dot indicates unstaged changes in a version control system (Git) and the green dot indicates staged changes: