> For the complete documentation index, see [llms.txt](https://www.techwithtyler.dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://www.techwithtyler.dev/operating-systems/macos/terminal-customization.md). Agents can also search and read this documentation through its [MCP server](https://www.techwithtyler.dev/~gitbook/mcp).

# Terminal Customization

How to improve default terminal experience

## Install Prerequisites

{% code overflow="wrap" expandable="true" %}

```zsh
brew install zsh-autosuggestions zsh-syntax-highlighting fzf
```

{% endcode %}

### Add to .zshrc file

{% code overflow="wrap" %}

```zsh
# ==========================================
# Homebrew & Completion Configuration
# ==========================================
FPATH="/opt/homebrew/share/zsh/site-functions:${FPATH}"

# Case-insensitive completion matching (must be BEFORE compinit)
zstyle ':completion:*' matcher-list 'm:{a-z}={A-Za-z}'
zstyle ':completion:*' menu select

autoload -Uz compinit
compinit -C


# ==========================================
# History Configuration
# ==========================================
HISTFILE=~/.zsh_history
HISTSIZE=100000
SAVEHIST=100000

setopt SHARE_HISTORY           # Sync history across tabs (includes incremental append)
setopt EXTENDED_HISTORY        # Store timestamps
setopt HIST_IGNORE_ALL_DUPS    # Remove older duplicate entries
setopt HIST_FIND_NO_DUPS       # Skip duplicates when searching
setopt HIST_REDUCE_BLANKS      # Trim extra whitespace
setopt HIST_IGNORE_SPACE       # Ignore commands starting with a space


# ==========================================
# Prompt & Git Configuration
# ==========================================
autoload -Uz vcs_info add-zsh-hook
add-zsh-hook precmd vcs_info
zstyle ':vcs_info:git:*' formats '[%b]'

COLOR_DEF='%f'
COLOR_USR='%F{243}'
COLOR_DIR='%F{197}'
COLOR_GIT='%F{39}'
NEWLINE=$'\n'

setopt PROMPT_SUBST
PROMPT='${COLOR_USR}%n@%m ${COLOR_DIR}%~ ${COLOR_GIT}${vcs_info_msg_0_}${COLOR_DEF}${NEWLINE}%% '


# ==========================================
# Aliases
# ==========================================
alias ls='ls -G'
alias ll='ls -lah'


# ==========================================
# Plugins (syntax highlighting must be last)
# ==========================================
# fzf key bindings and fuzzy completion (hit CTRL+R to use)
source <(fzf --zsh)

# Suggestions based on previously used commands
ZSH_AUTOSUGGEST_STRATEGY=(history completion)
source /opt/homebrew/share/zsh-autosuggestions/zsh-autosuggestions.zsh

# Highlights commands as you type
source /opt/homebrew/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
```

{% endcode %}
