One Sketch Away

Oh My Zsh

Created by Ranjith Vijayan, last modified on Jul 13, 2022

If you are using Linux or Mac OS X, Oh-My-Zsh is a great tool to manager your ZSH shell

This article provides basic configuration steps for zsh and oh-my-zh configuration

Install ZSH
    Check if zsh is installed


    which zsh


        if the output is like below then proceed to install


        which: no zsh in (/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin)
        If zsh is not installed, you can install by yum install zsh
        $ sudo yum install zsh -y

        Sample output
         Collapse source
        Failed to set locale, defaulting to C
        Loaded plugins: langpacks, ulninfo
        Resolving Dependencies
        --> Running transaction check
        ---> Package zsh.x86_64 0:5.0.2-34.el7_8.2 will be installed
        --> Finished Dependency Resolution
         
        Dependencies Resolved
         
        ==============================================================================================================================================================================================================================================
         Package                                             Arch                                                   Version                                                          Repository                                                  Size
        ==============================================================================================================================================================================================================================================
        Installing:
         zsh                                                 x86_64                                                 5.0.2-34.el7_8.2                                                 ol7_latest                                                 2.4 M
         
        Transaction Summary
        ==============================================================================================================================================================================================================================================
        Install  1 Package
         
        Total download size: 2.4 M
        Installed size: 5.6 M
        Downloading packages:
        zsh-5.0.2-34.el7_8.2.x86_64.rpm                                                                                                                                                                                        | 2.4 MB  00:00:01
        Running transaction check
        Running transaction test
        Transaction test succeeded
        Running transaction
        Warning: RPMDB altered outside of yum.
          Installing : zsh-5.0.2-34.el7_8.2.x86_64                                                                                                                                                                                                1/1
          Verifying  : zsh-5.0.2-34.el7_8.2.x86_64                                                                                                                                                                                                1/1
         
        Installed:
          zsh.x86_64 0:5.0.2-34.el7_8.2
         
        Complete!
        Now zsh should be available


        $ which zsh
        /usr/bin/zsh
Install oh-my-zsh


wget https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O - | zsh
cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc
source ~/.zshrc
Customize zsh Theme
    Following are some my favorite themes  (Powerlevel10k or agnoster).
        powerlevel10k - Follow https://github.com/romkatv/powerlevel10k#oh-my-zsh


        git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k


        Edit ZSH_TEHEME (edit ~/.zshrc  → entry ZSH_THEM)
        #ZSH_THEME="robbyrussell"
        ZSH_THEME="powerlevel10k/powerlevel10k"
         "agnoster' by editing ~/.zshrc  → entry ZSH_THEME


        #ZSH_THEME="robbyrussell"
        ZSH_THEME="agnoster"
Install / configure plugins 
    Auto-complete is a useful plugin.


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

    edit ~/.zshrc  → entry plugins → add "zsh-autosuggestions". Also you may use other useful plugins such as docker / docker-compose 
    plugins=(git docker docker-compose zsh-autosuggestions)
    set -o vi
Fuzzy Finder (fzf) (https://github.com/junegunn/fzf#using-git)
    git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf
    ~/.fzf/install

If you want to disable auto update, please add this entry to the beginning of .zshrc file. Else zsh will try to automatically lookup for updates every time when the shell is initiated.
    DISABLE_AUTO_UPDATE="true"

To upgrade zsh to 5.8: https://github.com/romkatv/zsh-bin

sh -c “$(curl -fsSL https://raw.githubusercontent.com/romkatv/zsh-bin/master/install)”