Skip to content

Instantly share code, notes, and snippets.

@gauravkeshre
Created September 21, 2021 17:23
Show Gist options
  • Save gauravkeshre/e0b248f75779b362505a60e5327324c0 to your computer and use it in GitHub Desktop.
Save gauravkeshre/e0b248f75779b362505a60e5327324c0 to your computer and use it in GitHub Desktop.
Custom Prompt for zsh in macOS Big Sur

ZCH seem to be the default shell for MacOs BigSur Terminals Which means that the old bash commands to beautify the terminal prompts are outdated. Here is a fresh new prompt for ZSH Terminal

Steps

  1. touch ~/.zshrc
  2. copy and paste from line 10 of this file
  3. save the .zshrc file
  4. run source ~/.zshrc
#!/bin/zsh

# Load version control information
autoload -Uz vcs_info
precmd() { vcs_info }

# Format the vcs_info_msg_0_ variable
zstyle ':vcs_info:git:*' formats '%F{8}⤞ %f%F{166}%b%f'
 
# Set up the prompt (with git branch name)
setopt PROMPT_SUBST
PROMPT='%F{166}%n%f%F{8} in%f %F{33}%1~%f ${vcs_info_msg_0_} 
%F{10}$%f '
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment