Esta página se muestra en inglés. Una traducción al español está en curso.
ScriptsMay 17, 2026·2 min de lectura

zsh-autosuggestions — Fish-Like Autosuggestions for Zsh

A Zsh plugin that suggests commands as you type based on history and completions, accepting suggestions with a single keystroke.

Listo para agents

Este activo puede ser leído e instalado directamente por agents

TokRepo expone un comando CLI universal, contrato de instalación, metadata JSON, plan según adaptador y contenido raw para que los agents evalúen compatibilidad, riesgo y próximos pasos.

Native · 98/100Política: permitir
Superficie agent
Cualquier agent MCP/CLI
Tipo
Skill
Instalación
Single
Confianza
Confianza: Established
Entrada
zsh-autosuggestions Overview
Comando CLI universal
npx tokrepo install 4431d30f-51eb-11f1-9bc6-00163e2b0d79

Introduction

zsh-autosuggestions brings Fish shell-style inline command suggestions to Zsh. As you type, it displays a grayed-out completion of the most likely command from your shell history, which you can accept with the right arrow key or end-of-line widget.

What zsh-autosuggestions Does

  • Displays inline suggestions based on command history as you type
  • Supports multiple suggestion strategies: history, completion, match_prev_cmd
  • Accepts full or partial suggestions with configurable key bindings
  • Updates suggestions in real-time with each keystroke
  • Integrates with Zsh completion system for context-aware suggestions

Architecture Overview

The plugin hooks into Zsh's ZLE (Zsh Line Editor) via precmd and preexec widgets. On each keypress, it queries the configured strategy (history file search by default) to find a matching prefix, then renders the suggestion as a ZLE buffer suffix with a dimmed color. Accepting the suggestion copies the suffix into the main buffer.

Self-Hosting & Configuration

  • Install via Oh My Zsh, Zinit, Zplug, Antigen, or Homebrew
  • Set ZSH_AUTOSUGGEST_STRATEGY=(history completion) for fallback ordering
  • Configure ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE to change suggestion color
  • Set ZSH_AUTOSUGGEST_BUFFER_MAX_SIZE to skip suggestions on long lines
  • Bind partial accept with bindkey for word-by-word acceptance

Key Features

  • Zero-latency suggestions that never block interactive typing
  • Strategy stacking: try history first, fall back to completion engine
  • Async mode for expensive completion strategies without input lag
  • Works seamlessly with syntax highlighting and other ZLE plugins
  • Minimal resource usage with no background processes

Comparison with Similar Tools

  • Fish shell — has autosuggestions built-in but requires switching shells
  • zsh-autocomplete — more aggressive real-time completion menu approach
  • fzf tab completion — fuzzy matching in a menu rather than inline suggestions
  • Atuin — full history database with search UI, heavier than inline hints

FAQ

Q: How do I accept only part of a suggestion? A: Press Ctrl+Right arrow to accept word-by-word, or bind forward-word to your preferred key.

Q: Can suggestions come from something other than history? A: Yes, set ZSH_AUTOSUGGEST_STRATEGY=(completion) to use the Zsh completion system.

Q: Does it conflict with zsh-syntax-highlighting? A: No, they work together. Load syntax-highlighting before autosuggestions for best results.

Q: How do I change the suggestion text color? A: Set ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE="fg=#808080" in your .zshrc.

Sources

Discusión

Inicia sesión para unirte a la discusión.
Aún no hay comentarios. Sé el primero en compartir tus ideas.

Activos relacionados