Top 10 Oh My Zsh Plugins For Productive Developers

 · 5 min read  ·

Zsh is a powerful shell, a popular alternative to bash, and the default shell on macOS. Oh My Zsh is an open source framework for Zsh with many themes and plugins. In this post, I’ll share my top 10 plugins and how they can make developers who use them, more productive.

Play

First, How to Install These Plugins

  1. In your terminal open ~/.zshrc with vi or nano (or notepad/code editor if you’re a bum)
  2. Add the desired plugins to your plugin list with spaces between like so:
plugins=(git kubectl history emoji encode64)

1. Zsh Autosuggestions

As you type, you’ll see a suggested completion come up in a faded gray color.

If you hit the right arrow key, it will fill in the suggestion. If you hit tab, it will list more suggestions below it. Continue to hit tab to cycle through.

I could honestly NOT survive anymore without the Zsh Autosuggestions plugin.

Note: This is the only plugin that requires you to actually install it first.

oh my zsh autosuggestion plugin

2. Sudo

You know when you type in a command that fails because you didn’t run sudo? Either you have to retype it with sudo at the front or hit the up arrow and then arrow back to the beginning of the sentence?

Well, the sudo plugin takes what you just typed and adds a sudo at the beginning for you.

The shortcut is to hit the escape key twice.

oh my zsh sudo plugin

3. Web Search

Imagine…you’re in the terminal and you need to google something.

No need to switch over to your browser, just run the search from your terminal with the Web Search

oh my zsh web search plugin

4. Copypath

Sometimes you are deep in a folder and remember that you have to go back to update another file in the parent.

You don’t want to have to go back out and re-input that long path over again.

Well, you don’t. You can use the Copypath plugin to copy the path to your current directory to the clipboard.

Run copypath to copy the absolute path of the directory you’re in, or copypath <file> to copy the path of a specific file.

Copy it. Go back out and do what you have to do. Then cd paste that bad boy back in.

5. Copyfile

Copy the contents of a file to your clipboard.

It’s a capability you don’t know you need until you need it. You can get ahead of the game now with the copyfile plugin.

oh my zsh copyfile plugin

6. Copybuffer

Copybuffer is a plugin that allows you to copy the text currently typed in the command line.

I know, I know… you can’t think of a specific scenario where you need this at the moment. But you will.

Ctrl+O copies the text to the clipboard.

oh my zsh copybuffer plugin

7. Dirhistory

This one is powerful.

Alt+Left takes you into the previous directory you were in. Alt+Right reverts that (moves you forward). And alt+up puts you in the parent directory.

See below how efficient the dirhistory plugin is.

oh my zsh dirhistory plugin

8. Zsh Syntax Highlighting

Zsh Syntax Highlighting colors your commands as you type them. A valid command turns green, a typo or nonexistent command turns red, so you catch mistakes before you ever hit Enter.

I run it right alongside Zsh Autosuggestions. Like that one, it lives outside the Oh My Zsh core, so you clone it first:

git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting

Then add zsh-syntax-highlighting to your plugin list. One note: it needs to be the last plugin in the list to work correctly.

oh my zsh zsh-syntax-highlighting plugin showing valid and invalid commands

9. History

The History command on any Unix system will show us a long list of commands that we have run in the past.

And if we want to recall a command from last week that we used, we grep it.

This plugin makes it as simple as a few keystrokes to search for past commands.

h - prints your history
hl - pipes your history through less so you can page and search it
hs [searchterm] - searches your history with grep
hsi [searchterm] - same as above but case insensitive.

oh my zsh history plugin

10. Json Tools

Don’t you hate to make an api call or curl request and return a bunch of jumbled json?

This plugin has a number of neat capabilities, but I mainly use it to pretty print json.

Just pipe your call with | pp_json

oh my zsh jsontools plugin

Bonus: macOS

For you Mac users, don’t miss these. I honestly could do a whole post on the macos plugin.

Here are a few of my favorites:

  1. ofd - Opens the current directory in a Finder window
  2. pfd - Prints the path of the frontmost Finder window
  3. cdf - cd to the current Finder selection.
  4. man-preview - Opens a specified man page in Preview app
  5. tab - Opens current directory in new tab
  6. showfiles/hidefiles - shows or hides hidden files

Once your plugins are set, give your prompt a facelift too. Check out my top 12 Oh My Zsh themes to round out your setup.

Discussion

What are your favorite terminal plugins for productivity?

This page may contain affiliate links. Please see my affiliate disclaimer for more info.

Related Posts

View All Posts »