How zsh-users/zsh-autosuggestions works
zsh-autosuggestions is a Zsh line-editor plugin that displays a muted inline suggestion as the user types. Its principal workflow is: ZLE widget activity triggers a fetch, configured strategies search history or ask the completion system, and the resulting suggestion is displayed; accept widgets can copy all or part of it into the command buffer. The README documents the capabilities and strategy behavior, but the runtime source was not excerpted, so internal call edges are omitted where their ownership cannot be verified.
Main entry points: fetch.zsh Strategy selection · completion.zsh Completion strategy · start.zsh Startup setup · bind.zsh Widget mapping
Components 18
Plugin entry
- Plugin loader
zsh-autosuggestions.zsh - Plugin script
zsh-autosuggestions.plugin.zsh - Startup setup
src/start.zsh - Configuration
src/config.zsh
ZLE interaction
- Widget mapping
src/bind.zsh - Suggestion widgets
src/widgets.zsh
Suggestion generation
- Suggestion fetch
src/fetch.zsh - Async fetching
src/async.zsh - Strategy selection
src/fetch.zsh - History strategy
src/strategies/history.zsh - Completion strategy
src/strategies/completion.zsh - Prior-command strategy
src/strategies/match_prev_cmd.zsh
Presentation
- Suggestion highlighting
src/highlight.zsh
Other components
- Shell user
- Zsh shell
- Zsh history
- Zsh completion system
- Zsh zpty module
Connections 19
- Shell user → Zsh shell: types commands
README.md - Zsh shell → Widget mapping: invokes widgets
README.md - Widget mapping → Suggestion widgets: dispatches behavior
README.md - Suggestion widgets → Suggestion fetch: fetches suggestion
README.md - Suggestion fetch → Strategy selection: tries strategies
README.md - Strategy selection → History strategy: selects strategy
README.md - Strategy selection → Completion strategy: selects strategy
README.md - Strategy selection → Prior-command strategy: selects strategy
README.md - History strategy → Zsh history: matches history
README.md - Prior-command strategy → Zsh history: matches history
README.md - Completion strategy → Zsh completion system: requests completions
README.md - Completion strategy → Zsh zpty module: requires module
README.md - Suggestion fetch → Async fetching: fetches asynchronously
README.md - Suggestion fetch → Suggestion highlighting: shows suggestion
README.md - Configuration → Strategy selection: configures strategy
README.md - Configuration → Suggestion highlighting: sets style
README.md - Startup setup → Widget mapping: sets up widgets
- Plugin loader → Startup setup: loads plugin
- Plugin script → Startup setup: loads plugin