Skip to content

Instantly share code, notes, and snippets.

@tobyjsullivan
Last active April 1, 2025 19:29
Show Gist options
  • Save tobyjsullivan/79d87f2b279f7b59a8d0f9b6b2aedf53 to your computer and use it in GitHub Desktop.
Save tobyjsullivan/79d87f2b279f7b59a8d0f9b6b2aedf53 to your computer and use it in GitHub Desktop.
.zshrc
# share history across sessions
setopt inc_append_history
setopt share_history
# Setup tab completion
autoload -Uz compinit
compinit
# fix opt+backspace on paths
autoload -U select-word-style
select-word-style bash
# customize prompt
## git branch name in prompt
function use_git_prompt()
{
autoload -Uz vcs_info
precmd_vcs_info() { vcs_info }
precmd_functions+=( precmd_vcs_info )
RPROMPT='%F{red}%B${vcs_info_msg_0_}%b%f'
# ref: https://zsh.sourceforge.io/Doc/Release/User-Contributions.html#vcs_005finfo-Variables
zstyle ':vcs_info:git:*' check-for-changes true
zstyle ':vcs_info:git:*' formats '(%b)%c%u'
}
## remove hostname from prompt
function use_clean_prompt()
{
PS1='%1~ %# '
}
setopt prompt_subst
use_git_prompt
use_clean_prompt
# Recommended by brew doctor
export PATH="/usr/local/sbin:$PATH"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment