Skip to content

Instantly share code, notes, and snippets.

@itsjavi
Created February 25, 2026 19:27
Show Gist options
  • Select an option

  • Save itsjavi/a8ccd7302dda755ae2c20b2c80adaf43 to your computer and use it in GitHub Desktop.

Select an option

Save itsjavi/a8ccd7302dda755ae2c20b2c80adaf43 to your computer and use it in GitHub Desktop.
Minimal and fast oh-my-zsh alternative

Minimal, fast zsh setup (Oh-My-Zsh replacement)

This gives you: - Ctrl+R history search (built-in) - History timestamps (short) - / search through history by what you already typed - Completion (autocomplete) - Autosuggestions (typeahead) - Syntax highlighting - Git branch in prompt - Date/time in prompt (via RPROMPT)


0) Backup existing config

cp ~/.zshrc ~/.zshrc.bak.$(date +%Y%m%d-%H%M%S)

1) Create a tiny plugin directory

mkdir -p ~/.zsh/plugins

2) Install only the two plugins we need

git clone https://github.com/zsh-users/zsh-autosuggestions ~/.zsh/plugins/zsh-autosuggestions
git clone https://github.com/zsh-users/zsh-syntax-highlighting ~/.zsh/plugins/zsh-syntax-highlighting

3) Replace ~/.zshrc with this minimal config

# -------------------------
# Minimal Zsh setup
# -------------------------

# ---- History (fast + timestamps) ----
HISTFILE="$HOME/.zsh_history"
HISTSIZE=50000
SAVEHIST=50000

setopt APPEND_HISTORY
setopt INC_APPEND_HISTORY
setopt SHARE_HISTORY
setopt HIST_IGNORE_DUPS
setopt HIST_IGNORE_ALL_DUPS
setopt HIST_REDUCE_BLANKS
setopt HIST_VERIFY
setopt EXTENDED_HISTORY     # stores timestamps in the history file

# Show timestamps when you run `history`
HIST_STAMPS="yyyy-mm-dd"

# ---- Keybindings ----
bindkey -e

# Ctrl+R reverse incremental history search (built-in)
bindkey '^R' history-incremental-search-backward

# Up/Down: search history by what you've typed so far
autoload -Uz up-line-or-beginning-search 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

# ---- Completion (autocomplete) ----
autoload -Uz compinit
compinit -C

zstyle ':completion:*' menu select
zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}'
zstyle ':completion:*' completer _complete _approximate

# ---- Git branch in prompt (built-in vcs_info) ----
autoload -Uz vcs_info
zstyle ':vcs_info:*' enable git
zstyle ':vcs_info:git:*' formats ' (%b)'
precmd() { vcs_info }

setopt PROMPT_SUBST

# Left prompt: user@host path (branch)
PROMPT='%F{cyan}%n@%m%f %F{blue}%~%f%F{magenta}${vcs_info_msg_0_}%f %# '

# Right prompt: date/time (clean + subtle)
RPROMPT='%F{yellow}%D{%H:%M}%f'

# ---- Autosuggestions ----
source "$HOME/.zsh/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh"

# ---- Syntax highlighting (MUST be last) ----
source "$HOME/.zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh"

4) Reload

exec zsh

5) Quick checks

  • Ctrl+R → reverse history search\
  • Type git then press → cycles matching commands\
  • history 5 → shows timestamps\
  • cd + Tab → completion menu\
  • Inside a git repo → prompt shows (branch)\
  • Right side shows time

Tweaks

Show date + time on the right

RPROMPT='%F{yellow}%D{%Y-%m-%d %H:%M}%f'

Put date/time on the left instead of RPROMPT

PROMPT='%F{yellow}%D{%Y-%m-%d %H:%M}%f %F{cyan}%n@%m%f %F{blue}%~%f%F{magenta}${vcs_info_msg_0_}%f %# '
RPROMPT=''
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment