en
engineering

Supercharging Shell Usability: FZF, Zsh Completions, and Modular Config

Optimize your Zsh environment on macOS. Learn how to integrate FZF for fuzzy searching, automate completions, and organize your shell scripts for a maintainable DevOps workflow.

Why This Matters

A “raw” shell is a blank slate that requires you to remember every flag and path. This cognitive load adds up over a long workday.

By adding Usability Improvements, you turn your terminal into an “autocomplete machine” that remembers your past successes and predicts your next move. You move from recalling commands to searching for them, which is significantly faster and less prone to typos.

Key Benefits

  • Reduced Memory Load: Stop memorizing complex kubectl or docker flags.
  • Instant Recall: Find that one-liner you wrote 3 months ago in 0.5 seconds.
  • Typo Prevention: Inline suggestions help you see errors before you hit Enter.

1. Fuzzy Everything with FZF

FZF is the glue that holds a modern CLI together. It’s a general-purpose fuzzy finder that makes searching through anything (files, history, processes) interactive and fast.

Enabling Zsh Integration

Add this to your ~/.zshrc:

# Set up fzf key bindings and fuzzy completion
source <(fzf --zsh)

Power Shortcuts

  • Ctrl + R: Search your command history with fuzzy matching.
  • Ctrl + T: Find a file and paste it into your command line.
  • Alt + C: Fuzzy search for a directory and cd into it.

2. Better Command History

The default Zsh history settings are too conservative. Let’s make it nearly infinite and shared across all your open terminal tabs.

# ~/.zshrc
HISTFILE=~/.zsh_history
HISTSIZE=100000
SAVEHIST=100000

# Options
setopt APPEND_HISTORY       # Don't overwrite history
setopt SHARE_HISTORY        # Share history between all sessions
setopt HIST_IGNORE_ALL_DUPS # Keep it clean
setopt HIST_REDUCE_BLANKS   # Remove wasted space

3. Real-time Suggestions

zsh-autosuggestions provides subtle gray text that predicts your command based on history.

Installation

brew install zsh-autosuggestions

Enabling

# ~/.zshrc
source $(brew --prefix)/share/zsh-autosuggestions/zsh-autosuggestions.zsh

Tip

When you see a suggestion you like, press the Right Arrow key to accept it. It feels like “IntelliSense” for your terminal.


4. Fixing “Word Navigation” for Paths

On macOS, the shell often treats a path like /Users/jose/code as a single word. If you try to delete one folder, you delete the whole thing.

The Fix

Add this to your ~/.zshrc to make Alt + Backspace stop at every slash:

autoload -U select-word-style
select-word-style bash

In the image below, you can see the how I first used Ctrl+R so fzf find the nvim command I was looking for and then I used Ctrl+T to find the file dot_zshrc. Finally, I pressed Alt + Backspace to jump and delete words.

Terminal showing the difference in &#x27;Alt + Backspace&#x27; behavior on a long path


5. Modular Configuration

Don’t let your ~/.zshrc become a 2,000-line “spaghetti” file. Break it into logical pieces.

~/.config/zsh/
├── aliases.zsh
├── functions.zsh
├── completion.zsh
└── prompt.zsh

Loading in .zshrc

for file in ~/.config/zsh/*.zsh; do
  source "$file"
done

Summary

Your shell is no longer just a prompt; it’s a productivity partner. It remembers your history, suggests your next moves, and navigates paths intelligently. Now that it works well, let’s make it look professional with the Starship Prompt.