Deja is a smarter replacement for
zsh-autosuggestions.
It learns which commands you run together and predicts what comes next, such
as make test after make build. It also uses fuzzy matching and your current
directory to find and rank commands from your history. Suggestions appear as
inline ghost text in your prompt.
Installation · Usage · Configuration · Troubleshooting · Security
- Sequence prediction: Learns command sequences, such as running
make testaftermake build. - Fuzzy matching: Type
gcoto findgit checkout. Skip letters while preserving their order. - Directory awareness: Commands you run in a project directory rank higher when you return there.
- Frecency scoring: Ranks commands using how often and how recently you ran them.
- Inline suggestions: Shows ghost text directly in your zsh prompt.
- Shared daemon: One background process serves all your terminal windows.
- Local storage: Keeps your command history in a local SQLite database without sending it to a server.
- History exclusions: Skips live commands excluded by
HIST_IGNORE_SPACEorHISTORY_IGNORE. - Alternatives picker: Press
Tabto cycle through ranked suggestions.
deja replaces zsh-autosuggestions. Remove that plugin before enabling deja. See plugin conflicts if deja reports that another suggestion plugin is active.
deja supports zsh on macOS and Linux, including WSL on Windows, with release
binaries for Intel/AMD (amd64) and ARM (arm64).
Install from Homebrew core:
brew install dejaFollow shell setup below, or use this one-liner to install deja,
import your history, configure ~/.zshrc, and restart zsh:
brew install deja && deja import && (grep -qF 'deja/init.zsh' ~/.zshrc 2>/dev/null || echo 'if [[ -r "$HOME/.local/share/deja/init.zsh" ]]; then source "$HOME/.local/share/deja/init.zsh"; else eval "$(deja init zsh)"; fi' >> ~/.zshrc) && exec zshOn macOS or Linux, including WSL on Windows:
curl -fsSL https://raw.githubusercontent.com/Giammarco-Ferranti/deja/main/install.sh | shThe installer imports history and adds the integration when it detects zsh.
Restart your shell with exec zsh after it finishes.
Read the installer
or see installer options.
Follow these steps if your installation method has not configured your shell.
-
Import your existing zsh history:
deja import
The importer reads an exported
$HISTFILE, or~/.zsh_historyotherwise. For a different location, usedeja import --file /path/to/history. -
Add this integration to
~/.zshrc:if [[ -r "$HOME/.local/share/deja/init.zsh" ]]; then source "$HOME/.local/share/deja/init.zsh" else eval "$(deja init zsh)" fi
If you use
$ZDOTDIR, edit the.zshrcin that directory instead. If a deja plugin already loads the integration, skip this step. -
Restart your shell:
exec zsh
The integration starts the daemon for you. Later shells source the cached script, which deja refreshes in the background when the binary changes.
Choose one method to load the integration. The installation guide also covers updating and uninstalling.
Start typing a command you have run before. For example, after running
git checkout main, typing gco can suggest it again. deja suggests commands
from your history; it does not generate new commands.
Press Right to copy the full suggestion into your command line, then press
Enter to run it. Enter alone runs only the text already in your buffer.
| Key | Action |
|---|---|
Right |
Accept the full suggestion |
Ctrl+Right |
Accept the next word |
Tab |
Open the alternatives picker and cycle through suggestions |
Ctrl+X |
Toggle suggestions for this shell session |
Shift+Right |
Cycle fuzzy presets forward: tight, smart, loose |
Shift+Left |
Cycle fuzzy presets backward: loose, smart, tight |
Shift+Up |
Toggle suggestions on an empty prompt |
Fuzzy presets and empty-prompt settings persist and affect the shared daemon.
Ctrl+X affects only the current shell. Terminal key sequences can differ;
see custom key bindings to remap them.
The default smart preset allows gaps between matched letters. Use tight
for smaller gaps or loose for larger ones:
deja fuzzy # show the current preset and examples
deja fuzzy tight # change the preset
deja fuzzy cycle # select the next preset
deja fuzzy back # select the previous presetWhen your input starts a command in your history, deja keeps suggestions within that command. Read about matching and anchoring.
deja also suggests a command before you start typing. To show suggestions only after you type, turn empty-prompt suggestions off:
deja empty offUse deja empty on to restore them, deja empty toggle to switch the setting,
or deja empty to check its current value.
Put shell settings above the lines that load deja in your .zshrc.
For example, change the ghost text colour:
export DEJA_HIGHLIGHT_STYLE='fg=cyan'The configuration guide covers key bindings, colours, fuzzy presets, and empty-prompt settings, including their scope and defaults.
If suggestions do not appear, run deja ping; a reachable daemon prints pong.
Check that your .zshrc loads the integration and that Ctrl+X has not
suppressed suggestions in the current shell.
After upgrading, replace the daemon from the previous version:
deja daemon --restartThis runs in the foreground. For a daemon started by the integration, follow daemon recovery.
See the troubleshooting guide for plugin conflicts,
faint ghost text, stale sockets, and database resets. Each subcommand also
supports --help, for example deja query --help.
deja stores command history in plaintext under ~/.local/share/deja/.
It restricts the data directory to 0700 and database files to 0600.
It does not encrypt history or automatically redact secrets in commands.
Enable setopt hist_ignore_space and prefix a sensitive command with a space
to keep deja's recording hook from forwarding it. See the
privacy guide for history exclusions and existing data.
Report a vulnerability privately. Read SECURITY.md for the reporting process and supported version policy. Keep vulnerability details out of public issues.
See CONTRIBUTING.md for development setup, checks, and release procedures. Open an issue before starting a larger change.
The architecture guide describes the shell integration, daemon, storage, and ranking algorithm. Release history is in CHANGELOG.md.
MIT.

