TopGit
GitHub Repo Review

zsh-autosuggestions: zsh autosuggest plugin for Zsh

zsh-users/zsh-autosuggestions
ZTopGit review image for zsh-users/zsh-autosuggestions
Review by Topgit.dev for zsh-users/zsh-autosuggestions, with GitHub repository stats and README context.
Quick verdict

zsh-autosuggestions does exactly one job: it prints a gray-text guess of the rest of your command, pulled from history or the completion engine, before you finish typing it. That single-purpose design is why it holds up as a daily driver instead of turning into another shell framework to maintain. It pays off for anyone who repeats commands often enough to notice the friction, at the small cost of one more script sourced in .zshrc.

Stars
★ 36.1k
Forks
⑂ 1.9k
Language
Shell
License
MIT
Topic
—
Updated
Jun 2025
Homepage
—
GitHub

Repeating commands from your shell history

Every Zsh user eventually retypes the same long docker run flags, git incantation, or ssh hostname dozens of times a week, and stock Zsh only helps if you remember to hit Ctrl+R and search for it. zsh-autosuggestions skips that step. As soon as you type enough of a command to match something you've run before, the rest of the line appears right there, no separate search UI required.

What zsh-autosuggestions does

zsh-autosuggestions is a Zsh plugin that shows a suggested command in muted gray text after your cursor as you type, based on matches from your shell history or the completion engine. It requires Zsh v4.3.11 or later and works by hooking into Zsh Line Editor (zle) widgets rather than replacing your prompt or shell. Press the right arrow or End to accept the full suggestion, or forward-word to take it piece by piece.

Customizing suggestion strategies and appearance

  • ✓Three interchangeable suggestion strategies — history (last matching command), completion (whatever tab-completion would offer, needs the zpty module), and match_prev_cmd (like history but keyed to the command you ran immediately before).
  • ✓ZSH_AUTOSUGGEST_STRATEGY takes an array, so you can chain strategies and fall through to the next one when the first finds nothing — try history, then completion.
  • ✓Suggestion color and style are configurable via ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE (foreground, background, bold, underline, standout), not just an on/off toggle.
  • ✓Five widget arrays (CLEAR, ACCEPT, EXECUTE, PARTIAL_ACCEPT, IGNORE_WIDGETS) let you rewire exactly which zle keybindings trigger which suggestion behavior.
  • ✓ZSH_AUTOSUGGEST_HISTORY_IGNORE and ZSH_AUTOSUGGEST_COMPLETION_IGNORE take glob patterns to silence suggestions for specific commands, like never suggesting cd * or git * completions.
  • ✓ZSH_AUTOSUGGEST_BUFFER_MAX_SIZE turns suggestions off past a buffer length, so pasting a big block of text doesn't trigger a lookup.
How this repository's GitHub stars have grown over time. Source: star-history.com.View the star history ↗

Installing the plugin

Exact install commands aren't clearly documented in what's given here — the README defers to a separate INSTALL.md file instead of listing steps inline. What is documented: zsh-autosuggestions needs Zsh v4.3.11 or later, and the Uninstallation section shows the shape of a typical install in reverse — the plugin lives as a cloned git repository (the README's own uninstall example uses ~/.zsh/zsh-autosuggestions as the path) and gets sourced from a line in ~/.zshrc, which you'd remove along with the repo to uninstall. If you run Oh My Zsh, the README recommends putting any ZSH_AUTOSUGGEST_* configuration overrides in a file inside your $ZSH_CUSTOM directory rather than editing .zshrc directly, so they survive framework updates.

Accepting and fine-tuning suggestions

Once sourced, zsh-autosuggestions works passively: start typing a command and it shows the rest of the line after your cursor in muted gray text (the color comes from ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE, default fg=8). With the cursor at the end of the buffer, pressing the right arrow (the forward-char widget) or End (end-of-line) accepts the whole suggestion and replaces the buffer with it. Invoking forward-word accepts only up to where the cursor lands — that's how you take a suggestion one word at a time. The plugin also exposes its own widgets — autosuggest-accept, autosuggest-execute, autosuggest-clear, autosuggest-fetch, autosuggest-disable, autosuggest-enable, and autosuggest-toggle — that you can bind yourself, for example bindkey '^ ' autosuggest-accept to accept with Ctrl+Space. Which source a suggestion comes from is controlled by ZSH_AUTOSUGGEST_STRATEGY, an array tried in order: history for your most recent matching command, completion for whatever the completion engine offers, or match_prev_cmd for a history match keyed to the command you ran right before it.

Strengths

  • ✓Single-purpose plugin — it only manages inline suggestions, so it doesn't fight with your prompt theme or completion framework.
  • ✓Configuration is granular down to individual widget behavior, not just a couple of toggles.
  • ✓Asynchronous suggestion fetching is on by default in modern zsh, so it doesn't block typing.
  • ✓MIT-licensed, so there's no licensing friction for using it anywhere.

Known limitations and quirks

  • △The README itself defers install steps to a separate INSTALL.md file rather than listing them inline, so the exact setup commands aren't spelled out in the main docs.
  • △The completion strategy depends on the zpty module, and the match_prev_cmd strategy breaks under HIST_IGNORE_ALL_DUPS or HIST_EXPIRE_DUPS_FIRST history options — an easy trap if you've already tuned your history settings.
  • △On zsh versions older than 5.0.8, there's a documented bug where ctrl+c doesn't reset the prompt immediately after an async suggestion fetch.
  • △Some iTerm2 users can't see suggestions at all until they fix a color conflict between the Background and Bright Black ANSI colors in their profile — a troubleshooting step the README has to call out explicitly.

Other zsh autocomplete options

fzf — swaps the always-on inline suggestion for an on-demand fuzzy search over your shell history (Ctrl+R), which some people prefer when history has thousands of near-duplicate entries. ↗Fish shell — has inline autosuggestions built into the shell itself, literally the behavior zsh-autosuggestions is modeled on; switching gets you the feature natively at the cost of leaving Zsh.zsh-history-substring-search — a smaller Zsh plugin focused on cycling through history matches by substring instead of showing a live inline guess.

Frequently asked questions

Is zsh-autosuggestions compatible with Oh My Zsh?

zsh-autosuggestions works alongside Oh My Zsh without conflict. The README specifically documents putting ZSH_AUTOSUGGEST_* configuration overrides into a file inside Oh My Zsh's $ZSH_CUSTOM directory, which keeps your settings from getting overwritten when Oh My Zsh updates its internals.

Which Zsh version do I need for zsh-autosuggestions?

zsh-autosuggestions requires Zsh v4.3.11 or later, per the plugin's stated requirements. If you want asynchronous suggestion fetching, which is on by default, you'll want Zsh 5.0.8 or newer — older versions have a known bug where ctrl+c doesn't reset the prompt right after an async fetch.

Can I disable autosuggest for specific commands like git?

zsh-autosuggestions supports disabling suggestions per command via glob patterns: set ZSH_AUTOSUGGEST_COMPLETION_IGNORE to "git *" to stop completion-based suggestions for git, or set ZSH_AUTOSUGGEST_HISTORY_IGNORE for history-based ones, for example to skip "cd *" or long history entries.

How do I change the suggestion color in zsh-autosuggestions?

Set the ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE variable to change how zsh-autosuggestions displays its suggestion text — foreground color, background color, bold, underline, or standout. The default is fg=8 from the 256-color palette; an 8-color terminal needs a value between 0 and 7 instead.

Does zsh-autosuggestions work on macOS?

zsh-autosuggestions has no OS-specific code — it runs anywhere Zsh v4.3.11 or later is available, which includes macOS. The README's troubleshooting section does flag one macOS-terminal-specific snag: iTerm2 users sometimes can't see suggestions until they fix a color conflict between the Background and Bright Black ANSI colors in their profile settings.

What is the difference between history and completion strategies?

The history strategy picks the most recent matching command from your shell history, while the completion strategy asks zsh's own tab-completion engine what it would suggest, which requires the zpty module. A third strategy, match_prev_cmd, is like history but only matches entries whose preceding command matches what you just ran.

Best use cases

  • •Typing long, repeatable commands — docker run flags, curl calls with headers, ssh aliases — where retyping the same string is pure friction.
  • •Working inside an existing Oh My Zsh setup, since the README documents dropping ZSH_AUTOSUGGEST_* overrides into a $ZSH_CUSTOM file.
  • •Terminal-heavy workflows where glancing at a gray suggestion beats breaking flow to hit Ctrl+R.
  • •Custom keybinding setups, since every accept/clear/execute action is exposed as its own zle widget you can bind independently.

Who should try it — and who should skip

Anyone who lives in a terminal and already knows their way around .zshrc should try zsh-autosuggestions — it's a small, single-purpose addition with no dependency beyond Zsh itself. Skip it if you rarely reuse commands, or if you'd rather not learn another set of ZSH_AUTOSUGGEST_* variables when something needs tuning — the completion strategy in particular expects you to understand zpty and your existing completion setup.

Related repositories

Source & attribution

Based on the zsh-users/zsh-autosuggestions GitHub repository (https://github.com/zsh-users/zsh-autosuggestions) and its README.

GitHub data · last synced Aug 15, 2026Reviewed by Henry
← Back to TopGit

Curious whether zsh-autosuggestions is right for you?

Let ChatGPT, Claude, or Perplexity look into it — click below and see what AI actually says about zsh-autosuggestions.

GitHub