
Three kinds of "autocomplete"
- Tab completion: press Tab and Zsh completes commands, options, file names and more. Oh My Zsh enables this for you.
- Autosuggestions: a faded suggestion from your history appears as you type. This comes from the external
zsh-autosuggestionsplugin. - Real-time completion menus: a completion list updates automatically while you type. This is what the separate
zsh-autocompleteproject does.
Built-in Tab Completion
Oh My Zsh initializes Zsh's completion system when it loads, so completion works immediately after installation. Press Tab once to complete, and press it again to open a menu you can move through with the arrow keys.
Plugins add completion for specific tools. Enabling git, docker or kubectl in your plugins list gives richer completion for those commands. See our Oh My Zsh plugins guide for more.
Completion settings in .zshrc
The default ~/.zshrc template includes commented options you can switch on by removing the leading #:
CASE_SENSITIVE="true"makes completion case-sensitive (it is case-insensitive by default).HYPHEN_INSENSITIVE="true"treats_and-as the same when completing.COMPLETION_WAITING_DOTS="true"shows dots while slow completions load.
Adding zsh-autosuggestions
This plugin suggests commands based on your history, similar to the Fish shell. Install it into the custom plugins folder:
git clone https://github.com/zsh-users/zsh-autosuggestions \
${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestionsAdd it to your plugins and reload:
plugins=(git zsh-autosuggestions)omz reloadPress the right arrow key or End to accept a suggestion. If suggestions are hard to see, your terminal colour scheme may make the faded text too dim; the plugin's README explains how to change the highlight style.
What is zsh-autocomplete?
zsh-autocomplete is an unaffiliated project, not part of Oh My Zsh. It shows completion candidates in real time as you type, without pressing Tab. Because it takes over parts of Zsh's completion system, it is sensitive to the order in which things load.
Installation and Load Order
Clone the project, then follow the load-order instructions in its README exactly:
git clone --depth 1 https://github.com/marlonrichert/zsh-autocomplete.git \
~/.zsh-autocompleteIts README asks you to source the plugin near the top of your .zshrc and to remove your own calls to compinit. Because Oh My Zsh initializes completion itself, test carefully after enabling it.
Using zsh-autocomplete and zsh-autosuggestions together, or with many completion-related plugins, can lead to overlapping behaviour. If completion feels erratic, disable one of them and compare.
Which should you choose?
| Option | Best for | Trade-off |
|---|---|---|
| Built-in tab completion | Everyone | Requires pressing Tab |
| zsh-autosuggestions | Repeating commands from history | Suggestions come from history only |
| zsh-autocomplete | People who want live menus | More complex setup and load order |
Most people are happy with built-in completion plus zsh-autosuggestions.
Fixing broken completion
Rebuild the completion cache
Zsh caches completion data in .zcompdump files. If completion behaves strangely after installing or removing plugins, delete the cache and reload:
rm -f ~/.zcompdump*
omz reload"zsh compinit: insecure directories"
This warning means some completion folders are writable by other users. List them with compaudit, then remove group and world write permission:
compaudit | xargs chmod g-w,o-wFor more fixes, see the Oh My Zsh troubleshooting guide.
Understand what completion can and cannot infer
Completion features appear similar at the prompt but solve distinct problems. Traditional tab completion proposes valid commands, filenames and options according to definitions available to the shell. History-based suggestions predict text you may wish to type again, while richer completion interfaces can present more interactive choices. Neither approach guarantees that a proposed command is appropriate for your current situation. A suggestion copied from history may refer to a different host, a deleted file or a command with destructive effects. Treat completion as assistance, not as a substitute for verifying what you intend to run.
The distinction matters when building an efficient configuration. If your primary frustration is remembering command options, improve completion definitions for the relevant tools. If you repeatedly retype long command sequences, history-based suggestions may offer greater value. If you work with large directories and need an exploratory interface, an interactive completion plugin can be appealing. Test these features separately before combining them, because multiple plugins may attempt to control the same widget or key bindings. The smallest combination that solves your recurring problems is often the most reliable.
Make suggestions predictable and secure
Completion behaviour depends on load order and the state of the shell initialization environment. Confirm that the framework and any required completion definitions are loaded before plugins that expect them. When a plugin is added, test basic filename completion, Git subcommands and a command with several flags. Check that pressing Tab, arrow keys and common editing shortcuts still behaves as intended. If key bindings change unexpectedly, inspect plugin documentation and activation order rather than creating additional overrides immediately. Clear, consistent editing gestures are central to working comfortably at a terminal.
History deserves special consideration because it can contain sensitive operational details. Avoid entering passwords, tokens and confidential strings as ordinary shell commands when safer input mechanisms exist. Review your history options and retention policy, especially on shared or managed machines. Suggestions generated from previous commands can be extremely convenient, but they also increase the visibility of what has been typed before. Configure history privacy according to your working environment, and understand the difference between removing a visible suggestion and actually removing an entry from stored history.
Keep completion fast as your setup grows
As the number of command-line tools increases, completion initialization may become more expensive. Review whether every installed tool needs its completion definitions loaded eagerly, and periodically assess startup performance. When completion unexpectedly stops working, check whether a plugin was moved, renamed or installed into the wrong directory. Rebuilding caches may help in some cases, but it is not a replacement for correcting incorrect permissions or broken initialization logic. A measured approach leaves you with a dependable, responsive command line rather than an unpredictable collection of clever features.
Conclusion
A thoughtful completion setup makes the command line faster without taking control away from the person using it. Understand the differences among tab completion, history suggestions and interactive completion, then choose the functions that solve real problems in your workflow. Review privacy, startup cost and key-binding compatibility as carefully as appearance. Reliable suggestions are a quiet convenience: they help you type with greater confidence while leaving final decisions firmly in your hands.

