zsh shell
- jfdesignnet
- Linux , Application
- September 27, 2023
I always spend most of my time in front of the computer in shell terminal or text editor for projects I’m working on, even for just to search some youtube video with ytfzf or ask a quick question to chatgpt with shellgpt , so, mostly I just revolve around coding in my ide and git on shell terminal.
If you work on many projects and always jump from one to another, there are times when you forget which branch you are working on, it can be annoying to knowing which branch you are on in a project and having to type git branch just for that, and worse, got mistakenly commit to the wrong branch and have to do git reset to revert. Yes, I know about aliases like gb for git branch and such, but of course it would be faster if the terminal shell told us which branch we are on in a git project directory.
I’d heard of zsh in the past and also knew that it was also the default shell on mac, but never had the time to really try it. I always thought zsh was just another alternative terminal for sh and bash, or something like allacrity or kitty for konsole terminals and such… until on one lazy sunday afternoon I saw a video screenshot of some guy on reddit about weston wayland things and it had the git branch info directly in his shell terminal when he switched between directories … yes, that is what I want 😄 … and that’s where I met your mother… mmmh, I mean zsh 🤩.
THE Z SHELL (ZSH)
ZSH, or Z shell, is a powerful Unix shell that is used by many developers and power users. It offers a number of features that make it a great choice for those who want a more customizable and powerful shell, such as a powerful syntax highlighter, a comprehensive set of built-in commands and functions, and a wide range of plugins that can be used to extend its functionality.
So, why wait any longer? ditch bash and install zsh.
Sure, do not uninstalling bash from the system of course, are you crazy? add zsh as a new shell for the system, and since i’m on arch then :
sudo pacman -S zsh
OH MY ZSH (OMG … no, actualy OMZ)
This is the story where all the funs begins, without oh-my-zsh, zsh felt like just another shell, similar to those I’d used before. Oh-my-zsh transforms zsh from a basic shell into a personalized powerhouse. Its extensive collection of plugins and themes unlocks a world of customization and usability, making it a joy to use.
Install oh-my-zsh using this :
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
• Themes
Zsh themes, dictate how your command prompt looks and behaves. They go beyond mere aesthetics, offering features like Git integration, virtual environment indicators, and more. Choosing the right theme can significantly enhance your command-line experience.
There are many themes that you can applied to zsh :
https://github.com/ohmyzsh/ohmyzsh/wiki/Themes
I like agnoster and Powerlevel10k theme, but that’s just my opinion.
• Plugins
Zsh plugins allow you to customize and improve your Zsh shell experience. They either enhance the appearance of your shell or the functionality.
There are also many plugins for zsh :
https://github.com/ohmyzsh/ohmyzsh/wiki/Plugins
and here is the five of them that i use on mine :
plugins=(
fzf
git
history-substring-search
zsh-autosuggestions
zsh-syntax-highlighting
)
Now I can forget clunky shell interfaces and boring prompts of bash, and for the best part … i got git branch info wherever i go.
Summary
zsh and oh-my-zsh are great additions to your system and turn your terminal into a stylish and functional workspace. However, it’s also a fairly resource-intensive addition to your system too, but it’s 2023 man … unless your system is a bag full of potatoes, there’s no reason to back off.