My Top 6 Essential Zsh Plugins
I've been using Zsh for a while now, and I've been using it for my daily work. With countless plugins and themes available, it can be overwhelming to choose the right ones. I've compiled a list of the top 6 essential Zsh plugins that I use every day.
Plugins:
- Git Plugin
- Zsh-autosuggestions Plugin
- Zsh-syntax-highlighting Plugin
- Autojump Plugin
- You-Should-Use Plugin
- Zsh-bat Plugin
1. Git Plugin
The git plugin comes bundled with Oh My Zsh and offers a collection of convenient aliases and functions for Git.
Instead of typing lengthy commands like git push origin "current_branch", you can simply type ggp
Typing one long command occasionally isn't a hassle. However, we interact with Git frequently as developers, and we spend a lot of time typing commands. That adds up in the long run, so why not save a few strokes? 😁😁😁
My most commonly used Git aliases are:
- gst - alias for git status
- gss - alias for git status -s
- ga - alias for git add .
- gco - alias for git checkout
- gcb - alias for git checkout -b
- ggp - alias for git push origin $(current_branch)
- ggpull - alias for git pull origin "$(git_current_branch)"
However, you can see all the available aliases here.
In case you want to create custom aliases, you can do so by adding them in the .zshrc file. Checkout my .zshrc configuration file if you want to see my custom aliases.
2. Zsh-autosuggestions Plugin
The zsh-autosuggestions plugin predicts and suggests command as you type, based on your history and completions. This feature saves time and reduces the number of keystrokes.
Installation with Oh My Zsh:
- Clone the plugin repository:
- Add the plugin to your .zshrc file:
- Reload your Zsh configuration:
3. Zsh-syntax-highlighting Plugin
The zsh-syntax-highlighting plugin provides syntax highlighting for your command line input, making it easier to spot errors and understand command structures.
Installation with Oh My Zsh:
- Clone the plugin repository:
- Add the plugin to your .zshrc file:
- Reload your Zsh configuration:
4. Autojump Plugin
Navigating deep directory structures can be time-consuming. The autojump plugin allows you to quickly jump to frequently used directories using a simple command.
How It Works:
Autojump tracks the directories you use most and assigns them a ranking. To jump to a directory, use:
For example:
This command takes you to the most frequently accessed directory matching "projects".
Installation:
- macOS (using Homebrew):
- Ubuntu/Debian:
After installing, add autojump to your plugins in .zshrc:
Reload your Zsh configuration:
Note: Make sure to spend some time navigating directories so Autojump can learn your usage patterns.
5. You-Should-Use Plugin
Remembering all your aliases can be challenging. The you-should-use plugin reminds you of existing aliases when you type out the full command, helping you adopt shortcuts more consistently.
Installation with Oh My Zsh:
- Clone the plugin repository:
- Add the plugin to your .zshrc file:
- Reload your Zsh configuration:
Now, when you type a command that has an alias, you'll receive a friendly reminder.
6. Zsh-bat Plugin
Upgrade your cat command with zsh-bat, which leverages the bat command to display file contents with syntax highlighting and Git integration.
Installation Steps:
- Install bat:
- macOS (using Homebrew):
- Ubuntu/Debian:
Note: On some systems, the bat command might be named batcat.
- Install the zsh-bat plugin:
- Add to your .zshrc file:
- Reload your Zsh configuration:
Now, using cat will automatically display files with enhanced readability.
Conclusion
By incorporating these plugins into your Zsh setup, you'll significantly improve your command line efficiency and enjoy a more streamlined development experience.
Keep coding, keep exploring, and keep inspiring. 🐼