# Top 10 Oh My Zsh Plugins For Productive Developers

<div class="lead-paragraph">
  <span class="dropcap">Z</span>shell is a powerful terminal and popular alternative to bash. Oh My Zsh is an open
  source framework for Zshell 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.
</div>
<div class="max-w-4xl mx-auto px-4 sm:px-6 pt-4">
  {' '}
  <div class="border-t dark:border-slate-700"></div>{' '}
</div>

{/* prettier-ignore-start */}
<div class="table-of-contents bg-lightblue dark:bg-transparent rounded-md">
  <div class="font-bold">Quick Nav</div>
  <div class="toc">
    <ol class="toc-list">
      <li><a href="#20210719-video">Video version</a></li>
      <li><a href="#20210719-zsh-auto">Zsh Autosuggestions</a></li>
      <li><a href="#20210719-sudo">Sudo</a></li>
      <li><a href="#20210719-web">Web Search</a></li>
      <li><a href="#20210719-copydir">Copydir</a></li>
      <li><a href="#20210719-copyfile">Copyfile</a></li>
      <li><a href="#20210719-copybuffer">Copybuffer</a></li>
      <li><a href="#20210719-dirhistory">Dirhistory</a></li>
      <li><a href="#20210719-zshreload">Zsh Reload</a></li>
      <li><a href="#20210719-history">History</a></li>
      <li><a href="#20210719-json">Json Tools</a></li>
      <li><a href="#20210719-osx">OSX</a></li>
    </ol>
  </div>
</div>

{/* prettier-ignore-end */}

<YouTube id="https://youtu.be/LEOqiyxx16c" />

<h2 id="20210719-video">First, How to Install These Plugins</h2>

1. In your terminal open ~/.zshrc with vi or nano (or notepad/code editor if your a bum)
2. Add the desired plugins to your plugin list with spaces between like so:

```shell
plugins=(git kubectl history emoji encode64)
```

<h2 id="20210719-zsh-auto">1. Zsh Autosuggestions</h2>

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 thorough.

I could honestly NOT survive anymore without the [Zsh Autosuggestions](https://github.com/zsh-users/zsh-autosuggestions) plugin.

**_Note_**: This is the only plugin that requires you to actually [install](https://github.com/zsh-users/zsh-autosuggestions/blob/master/INSTALL.md) it first.

<Image src={autosuggestion} alt="oh my zsh autosuggestion plugin" />

<h2 id="20210719-sudo">2. Sudo</h2>

You know when you type in a command that fails because you didnt 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](https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/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.

<Image src={sudo} alt="oh my zsh sudo plugin" />

<h2 id="20210719-web">3. Web Search</h2>

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](https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/web-search)

<Image src={websearch} alt="oh my zsh web search plugin" />

<h2 id="20210719-copydir">4. Copydir</h2>

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

[Copydir](https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/copydir) plugin to copy the path to your current directory to the clipboard.{' '}

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

<Image src={copydir} alt="oh my zsh copydir plugin" />

<h2 id="20210719-copyfile">5. Copyfile</h2>

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](https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/copyfile) plugin.

<Image src={copyfile} alt="oh my zsh copyfile plugin" />

<h2 id="20210719-copybuffer">6. Copybuffer</h2>

[Copybuffer](https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/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.

<Image src={copybuffer} alt="oh my zsh copybuffer plugin" />

<h2 id="20210719-dirhistory">7. Dirhistory</h2>

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](https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/dirhistory) plugin is.

<Image src={dirhistory} alt="oh my zsh dirhistory plugin" />

<h2 id="20210719-zshreload">8. Zsh Reload</h2>

**_This plugin is now deprecated. You can run the command "exec zsh" instead._**

You know when you make changes to .bashrc or .bash_history or .zshrc, and you have to reopen the terminal or "source" it to refresh.

Well now just type src and hit enter to refresh the zsh session.

This [plugin](https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/zsh_reload) is a real time saver.

<Image src={zshreload} alt="oh my zsh zshreload plugin" />

<h2 id="20210719-history">9. History</h2>

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](https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/history) makes it as simple as a few keystrokes to search for past commands.

h - prints your history<br />
hs [searchterm] - searches your history with grep<br />
hsi [serachterm] - same as above but case insensitive.

<Image src={history} alt="oh my zsh history plugin" />

<h2 id="20210719-json">10. Json Tools</h2>

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

This [plugin](https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/jsontools) has a number of neat capabilities, but I mainly use it to pretty print json.

Just pipe your call with | pp_json

<Image src={jsontools} alt="oh my zsh jsontools plugin" />

<h2 id="20210719-zsh-auto">Bonus: OSX</h2>

{/* prettier-ignore */}
<a href="/favorite-udemy-course-of-2021-as-a-software-developer/"><Image src={osx} alt="udemy python course recommendation" /></a>

For you Mac users, don't miss these. I honestly could do a whole post on this [plugin](https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/osx).

**_The osx plugin is now deprecated and has been renamed to macos. It's all the same functionality and can be found [here](https://github.com/ohmyzsh/ohmyzsh/tree/master/plugins/macos). Be sure to update the name in your .zshrc plugins._**

Here are a few of my favorites:<br />

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

### Discussion

What are your favorite terminal plugins for productivity?