Skip to content

Instantly share code, notes, and snippets.

@rstecca
Last active November 12, 2020 16:49
Show Gist options
  • Save rstecca/c3da09e6996a2894fdfca6689bcab21e to your computer and use it in GitHub Desktop.
Save rstecca/c3da09e6996a2894fdfca6689bcab21e to your computer and use it in GitHub Desktop.
macOS .zshrc boilerplate (essential with current git branch)
#!/bin/zsh
export EDITOR="nvim"
export VISUAL="nvim"
export ZDOTDIR="$XDG_CONFIG_HOME/zsh"
export HISTFILE="$ZDOTDIR/.zhistory" # History filepath
export HISTSIZE=10000 # Maximum events for internal history
export SAVEHIST=10000
autoload -U promptinit
promptinit
# prompt bart # red yellow magenta
autoload -Uz compinit; compinit
# - # - # - # - # - # - # - # - # - # - # - # - #
## https://git-scm.com/book/en/v2/Appendix-A%3A-Git-in-Other-Environments-Git-in-Zsh
autoload -Uz vcs_info
precmd_vcs_info() { vcs_info }
precmd_functions+=( precmd_vcs_info )
setopt prompt_subst
RPROMPT=\$vcs_info_msg_0_
# PROMPT=\$vcs_info_msg_0_'%# '
zstyle ':vcs_info:git:*' formats '%b'
# - # - # - # - # - # - # - # - # - # - # - # - #
autoload -U colors && colors1 ## load colors definitions
## how this prompt was built (mini tutorial)
## PROMPT="[%n] " ## show username
## PROMPT="[%n]%~ " ## add the path relative to ~
## PROMPT="[%n]%~ %% " ## add '%'
## PROMPT="[%n]%~ %B%%%b " ## add bold to '%'
PROMPT="%{%F{cyan}%}[%n]%~%{%f%} %B%%%b " ## add colors (reset with %{%f%})
PROMPT="%{%F{cyan}%}%n]%~%{%f%} %B%%%b " ## got rid of a '[' because.
export PATH="/usr/local/sbin:$PATH"
@rstecca
Copy link
Author

rstecca commented Nov 12, 2020

Tested in macOS Catalina

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment