Enabling Command Autocompletion in ZSH (2024)

Table of Contents
Enabling the Plugin Conclusion
Enabling Command Autocompletion in ZSH (2)

My current workstation setup consists of a 16" M1 Pro MacBook Pro. I have thoroughly enjoyed it but have found that iTerm2 and OhMyZSH have made for excellent additions to my workflow.

iTerm 2 acts as a no-frills, yet feature rich, terminal for MacOS devices. OhMyZSH builds on top of this, offering a plethora of features including plugins. Today's quick write up will cover my favorite plugin offered for ZSH: command autocompletion.

I find this plugin extremely convenient when trying to ssh to servers within my lab or at work. Rather than having to manually type out each and every hostname, I'm able to simply begin typing the start of the hostname and then press Tab to autocomplete the rest of the hostname

Enabling Command Autocompletion in ZSH (3)

Enabling the Plugin

Assuming you already have iTerm2 and OhMyZSH already installed, it's simply a matter of altering your ~/.zshrc file. As indicated by the ~, this file is located within your home directory.

To enable the plugin, open the file in a text editor of your choice. For the purposes of this tutorial, I will be using VIM.

Enabling Command Autocompletion in ZSH (4)

After navigating down through the file, you should see a plugins section. Here, all that is needed is adding zsh-autosuggestions to the plugins list, just like I have shown above.

Once done, run source ~/.zshrc

Conclusion

That's all there is to it! You should now have functional command autocompletion with your terminal.

I hope you found this guide helpful. If you did, consider adding my site to your RSS reader using the following URL:

https://tcude.net/rss

Enabling Command Autocompletion in ZSH (2024)
Top Articles
Latest Posts
Article information

Author: Velia Krajcik

Last Updated:

Views: 5743

Rating: 4.3 / 5 (74 voted)

Reviews: 89% of readers found this page helpful

Author information

Name: Velia Krajcik

Birthday: 1996-07-27

Address: 520 Balistreri Mount, South Armand, OR 60528

Phone: +466880739437

Job: Future Retail Associate

Hobby: Polo, Scouting, Worldbuilding, Cosplaying, Photography, Rowing, Nordic skating

Introduction: My name is Velia Krajcik, I am a handsome, clean, lucky, gleaming, magnificent, proud, glorious person who loves writing and wants to share my knowledge and understanding with you.